home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1993-03-23 | 916.4 KB | [ ONLN/HLX2]
open in: MacOS 8.1
extracted
|
Win98
extracted
|
DOS
extracted
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary ).
Confidence Program Detection Match Type Support
10%
dexvert
MacBinary (archive/macBinary)
fallback
Supported
100%
file
MacBinary II, inited, Mon Mar 22 23:14:58 1993, modified Mon Mar 22 23:15:12 1993, creator 'HLX2', type 'ONLN', 932451 bytes "Color on 1-bit Devices" , at 0xe3ae3 5658 bytes resource
default (weak)
99%
file
data
default
100%
TrID
MacBinary 2
default (weak)
100%
siegfried
fmt/1762 MacBinary (II)
default
100%
lsar
MacBinary
default
id metadata key value macFileType [ ONLN] macFileCreator [ HLX2]
hex view +--------+-------------------------+-------------------------+--------+--------+ |00000000| 00 16 43 6f 6c 6f 72 20 | 6f 6e 20 31 2d 62 69 74 |..Color |on 1-bit| |00000010| 20 44 65 76 69 63 65 73 | 00 00 00 00 00 00 00 00 | Devices|........| |00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......| |00000050| 00 00 00 00 0e 3a 63 00 | 00 16 1a a7 d4 3f 42 a7 |.....:c.|.....?B.| |00000060| d4 3f 50 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.?P.....|........| |00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 6c 16 00 00 |........|....l...| |00000080| 4d 41 4b 49 4e 47 20 54 | 48 45 20 4d 4f 53 54 20 |MAKING T|HE MOST | |00000090| 4f 46 20 43 4f 4c 4f 52 | 20 4f 4e 20 31 2d 42 49 |OF COLOR| ON 1-BI| |000000a0| 54 20 44 45 56 49 43 45 | 53 4b 6f 6e 73 74 61 6e |T DEVICE|SKonstan| |000000b0| 74 69 6e 20 6f 74 68 6d | 65 72 20 61 6e 64 20 44 |tin othm|er and D| |000000c0| 61 6e 69 65 6c 20 6c 69 | 70 74 6f 6e 0d 4d 61 63 |aniel li|pton.Mac| |000000d0| 69 6e 74 6f 73 68 20 64 | 65 76 65 6c 6f 70 65 72 |intosh d|eveloper| |000000e0| 73 20 66 61 63 65 64 20 | 77 69 74 68 20 74 68 65 |s faced |with the| |000000f0| 20 64 69 6c 65 6d 6d 61 | 20 6f 66 20 77 68 69 63 | dilemma| of whic| |00000100| 68 20 70 6c 61 74 66 6f | 72 6d 20 74 6f 20 64 65 |h platfo|rm to de| |00000110| 76 65 6c 6f 70 20 73 6f | 66 74 77 61 72 65 20 66 |velop so|ftware f| |00000120| 6f 72 d1 6d 61 63 68 69 | 6e 65 73 20 77 69 74 68 |or.machi|nes with| |00000130| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 51 75 | the ori|ginal Qu| |00000140| 69 63 6b 44 72 61 77 20 | 6f 72 20 74 68 6f 73 65 |ickDraw |or those| |00000150| 20 77 69 74 68 20 43 6f | 6c 6f 72 20 51 75 69 63 | with Co|lor Quic| |00000160| 6b 44 72 61 77 d1 63 61 | 6e 20 61 6c 77 61 79 73 |kDraw.ca|n always| |00000170| 20 63 68 6f 6f 73 65 20 | 74 6f 20 77 72 69 74 65 | choose |to write| |00000180| 20 63 6f 64 65 20 74 68 | 61 74 20 72 75 6e 73 20 | code th|at runs | |00000190| 61 64 65 71 75 61 74 65 | 6c 79 20 6f 6e 20 74 68 |adequate|ly on th| |000001a0| 65 20 6c 6f 77 65 72 2d | 65 6e 64 20 6d 61 63 68 |e lower-|end mach| |000001b0| 69 6e 65 73 20 61 6e 64 | 20 67 69 76 65 73 20 61 |ines and| gives a| |000001c0| 64 64 69 74 69 6f 6e 61 | 6c 20 66 75 6e 63 74 69 |dditiona|l functi| |000001d0| 6f 6e 61 6c 69 74 79 20 | 77 68 65 6e 20 72 75 6e |onality |when run| |000001e0| 6e 69 6e 67 20 6f 6e 20 | 74 68 65 20 68 69 67 68 |ning on |the high| |000001f0| 65 72 2d 65 6e 64 20 6d | 61 63 68 69 6e 65 73 2e |er-end m|achines.| |00000200| 20 57 68 69 6c 65 20 74 | 68 69 73 20 73 6f 75 6e | While t|his soun| |00000210| 64 73 20 6c 69 6b 65 20 | 61 20 73 69 6d 70 6c 65 |ds like |a simple| |00000220| 20 61 6e 64 20 65 6c 65 | 67 61 6e 74 20 73 6f 6c | and ele|gant sol| |00000230| 75 74 69 6f 6e 2c 20 69 | 74 20 67 65 6e 65 72 61 |ution, i|t genera| |00000240| 6c 6c 79 20 72 65 71 75 | 69 72 65 73 20 61 20 67 |lly requ|ires a g| |00000250| 72 65 61 74 20 64 65 61 | 6c 20 6f 66 20 64 65 76 |reat dea|l of dev| |00000260| 65 6c 6f 70 6d 65 6e 74 | 20 61 6e 64 20 74 65 73 |elopment| and tes| |00000270| 74 69 6e 67 20 65 66 66 | 6f 72 74 2e 20 54 6f 20 |ting eff|ort. To | |00000280| 6d 61 6b 65 20 74 68 69 | 73 20 65 66 66 6f 72 74 |make thi|s effort| |00000290| 20 65 61 73 69 65 72 20 | 61 6e 64 20 74 68 65 20 | easier |and the | |000002a0| 6f 75 74 63 6f 6d 65 20 | 6d 6f 72 65 20 73 61 74 |outcome |more sat| |000002b0| 69 73 66 79 69 6e 67 2c | 20 77 65 20 6f 66 66 65 |isfying,| we offe| |000002c0| 72 20 74 65 63 68 6e 69 | 71 75 65 73 20 74 6f 20 |r techni|ques to | |000002d0| 73 61 76 65 20 63 6f 6c | 6f 72 20 69 6d 61 67 65 |save col|or image| |000002e0| 73 20 61 6e 64 20 70 72 | 6f 63 65 73 73 20 74 68 |s and pr|ocess th| |000002f0| 65 6d 20 66 6f 72 20 64 | 69 73 70 6c 61 79 20 6f |em for d|isplay o| |00000300| 6e 20 31 2d 62 69 74 20 | 28 62 6c 61 63 6b 2d 61 |n 1-bit |(black-a| |00000310| 6e 64 2d 77 68 69 74 65 | 29 20 64 65 76 69 63 65 |nd-white|) device| |00000320| 73 2e 20 0d 53 75 70 70 | 6f 73 65 20 79 6f 75 d5 |s. .Supp|ose you.| |00000330| 72 65 20 77 72 69 74 69 | 6e 67 20 61 20 70 72 6f |re writi|ng a pro| |00000340| 67 72 61 6d 20 74 68 61 | 74 20 63 6f 6e 74 72 6f |gram tha|t contro| |00000350| 6c 73 20 61 20 32 34 2d | 62 69 74 20 63 6f 6c 6f |ls a 24-|bit colo| |00000360| 72 20 73 63 61 6e 6e 65 | 72 20 61 6e 64 20 79 6f |r scanne|r and yo| |00000370| 75 d5 64 20 6c 69 6b 65 | 20 69 74 20 74 6f 20 77 |u.d like| it to w| |00000380| 6f 72 6b 20 6f 6e 20 61 | 6c 6c 20 4d 61 63 69 6e |ork on a|ll Macin| |00000390| 74 6f 73 68 20 63 6f 6d | 70 75 74 65 72 73 2e 20 |tosh com|puters. | |000003a0| 54 68 65 20 70 72 6f 62 | 6c 65 6d 20 79 6f 75 d5 |The prob|lem you.| |000003b0| 6c 6c 20 72 75 6e 20 69 | 6e 74 6f 20 69 73 20 74 |ll run i|nto is t| |000003c0| 68 61 74 20 6d 61 63 68 | 69 6e 65 73 20 77 69 74 |hat mach|ines wit| |000003d0| 68 20 74 68 65 20 6f 72 | 69 67 69 6e 61 6c 20 51 |h the or|iginal Q| |000003e0| 75 69 63 6b 44 72 61 77 | 20 28 74 68 6f 73 65 20 |uickDraw| (those | |000003f0| 62 61 73 65 64 20 6f 6e | 20 74 68 65 20 36 38 30 |based on| the 680| |00000400| 30 30 20 6d 69 63 72 6f | 70 72 6f 63 65 73 73 6f |00 micro|processo| |00000410| 72 29 20 6f 6e 6c 79 20 | 68 61 76 65 20 73 75 70 |r) only |have sup| |00000420| 70 6f 72 74 20 66 6f 72 | 20 62 69 74 6d 61 70 73 |port for| bitmaps| |00000430| 2c 20 74 68 75 73 20 73 | 65 76 65 72 65 6c 79 20 |, thus s|everely | |00000440| 63 72 69 70 70 6c 69 6e | 67 20 74 68 65 20 70 6f |cripplin|g the po| |00000450| 74 65 6e 74 69 61 6c 20 | 6f 66 20 79 6f 75 72 20 |tential |of your | |00000460| 73 63 61 6e 6e 65 72 2e | 20 42 75 74 20 64 6f 6e |scanner.| But don| |00000470| d5 74 20 64 65 73 70 61 | 69 72 2e 20 49 6e 20 6f |.t despa|ir. In o| |00000480| 75 72 20 63 6f 6e 74 69 | 6e 75 69 6e 67 20 71 75 |ur conti|nuing qu| |00000490| 65 73 74 20 74 6f 20 61 | 64 64 20 43 6f 6c 6f 72 |est to a|dd Color| |000004a0| 20 51 75 69 63 6b 44 72 | 61 77 20 66 75 6e 63 74 | QuickDr|aw funct| |000004b0| 69 6f 6e 61 6c 69 74 79 | 20 74 6f 20 6d 61 63 68 |ionality| to mach| |000004c0| 69 6e 65 73 20 77 69 74 | 68 20 6f 72 69 67 69 6e |ines wit|h origin| |000004d0| 61 6c 20 51 75 69 63 6b | 44 72 61 77 2c 20 77 65 |al Quick|Draw, we| |000004e0| d5 76 65 20 77 6f 72 6b | 65 64 20 6f 75 74 20 74 |.ve work|ed out t| |000004f0| 65 63 68 6e 69 71 75 65 | 73 20 74 6f 20 73 61 76 |echnique|s to sav| |00000500| 65 20 63 6f 6c 6f 72 20 | 69 6d 61 67 65 73 20 61 |e color |images a| |00000510| 6e 64 20 70 72 6f 63 65 | 73 73 20 74 68 65 6d 20 |nd proce|ss them | |00000520| 66 6f 72 20 64 69 73 70 | 6c 61 79 2c 20 61 6c 62 |for disp|lay, alb| |00000530| 65 69 74 20 69 6e 20 62 | 6c 61 63 6b 20 61 6e 64 |eit in b|lack and| |00000540| 20 77 68 69 74 65 2c 20 | 6f 6e 20 74 68 65 20 6c | white, |on the l| |00000550| 61 74 74 65 72 20 6d 61 | 63 68 69 6e 65 73 2e 20 |atter ma|chines. | |00000560| 57 65 d5 76 65 20 61 6c | 73 6f 20 63 6f 6d 65 20 |We.ve al|so come | |00000570| 75 70 20 77 69 74 68 20 | 61 20 74 65 63 68 6e 69 |up with |a techni| |00000580| 71 75 65 20 74 6f 20 61 | 64 64 72 65 73 73 20 74 |que to a|ddress t| |00000590| 68 65 20 70 72 6f 62 6c | 65 6d 20 6f 66 20 61 20 |he probl|em of a | |000005a0| 6c 61 73 65 72 20 70 72 | 69 6e 74 65 72 d5 73 20 |laser pr|inter.s | |000005b0| 69 6e 61 62 69 6c 69 74 | 79 20 74 6f 20 72 65 73 |inabilit|y to res| |000005c0| 6f 6c 76 65 20 73 69 6e | 67 6c 65 20 70 69 78 65 |olve sin|gle pixe| |000005d0| 6c 73 2c 20 77 68 69 63 | 68 20 72 65 73 75 6c 74 |ls, whic|h result| |000005e0| 73 20 69 6e 20 64 69 73 | 74 6f 72 74 65 64 20 69 |s in dis|torted i| |000005f0| 6d 61 67 65 20 6f 75 74 | 70 75 74 2e 20 54 68 69 |mage out|put. Thi| |00000600| 73 20 61 72 74 69 63 6c | 65 20 61 6e 64 20 74 68 |s articl|e and th| |00000610| 65 20 61 63 63 6f 6d 70 | 61 6e 79 69 6e 67 20 73 |e accomp|anying s| |00000620| 61 6d 70 6c 65 20 63 6f | 64 65 20 28 6f 6e 20 74 |ample co|de (on t| |00000630| 68 65 20 44 65 76 65 6c | 6f 70 65 72 20 43 44 20 |he Devel|oper CD | |00000640| 53 65 72 69 65 73 20 64 | 69 73 63 29 20 73 68 61 |Series d|isc) sha| |00000650| 72 65 20 74 68 65 73 65 | 20 74 65 63 68 6e 69 71 |re these| techniq| |00000660| 75 65 73 20 77 69 74 68 | 20 79 6f 75 2e 0d 53 41 |ues with| you..SA| |00000670| 56 49 4e 47 20 43 4f 4c | 4f 52 20 49 4d 41 47 45 |VING COL|OR IMAGE| |00000680| 53 0d 54 68 65 20 6b 65 | 79 20 74 6f 20 73 61 76 |S.The ke|y to sav| |00000690| 69 6e 67 20 63 6f 6c 6f | 72 20 69 6d 61 67 65 73 |ing colo|r images| |000006a0| 20 69 73 20 75 73 69 6e | 67 20 70 69 63 74 75 72 | is usin|g pictur| |000006b0| 65 73 2e 20 52 65 63 61 | 6c 6c 20 74 68 61 74 20 |es. Reca|ll that | |000006c0| 61 20 70 69 63 74 75 72 | 65 20 28 6f 72 20 50 49 |a pictur|e (or PI| |000006d0| 43 54 29 20 69 6e 20 51 | 75 69 63 6b 44 72 61 77 |CT) in Q|uickDraw| |000006e0| 20 69 73 20 61 20 74 72 | 61 6e 73 63 72 69 70 74 | is a tr|anscript| |000006f0| 20 6f 66 20 63 61 6c 6c | 73 20 74 6f 20 72 6f 75 | of call|s to rou| |00000700| 74 69 6e 65 73 20 74 68 | 61 74 20 64 72 61 77 20 |tines th|at draw | |00000710| 73 6f 6d 65 74 68 69 6e | 67 d1 61 6e 79 74 68 69 |somethin|g.anythi| |00000720| 6e 67 2e 20 41 20 50 49 | 43 54 20 63 72 65 61 74 |ng. A PI|CT creat| |00000730| 65 64 20 6f 6e 20 6f 6e | 65 20 4d 61 63 69 6e 74 |ed on on|e Macint| |00000740| 6f 73 68 20 63 61 6e 20 | 62 65 20 64 69 73 70 6c |osh can |be displ| |00000750| 61 79 65 64 20 6f 6e 20 | 61 6e 79 20 6f 74 68 65 |ayed on |any othe| |00000760| 72 20 4d 61 63 69 6e 74 | 6f 73 68 20 28 70 72 6f |r Macint|osh (pro| |00000770| 76 69 64 65 64 20 74 68 | 65 20 76 65 72 73 69 6f |vided th|e versio| |00000780| 6e 20 6f 66 20 73 79 73 | 74 65 6d 20 73 6f 66 74 |n of sys|tem soft| |00000790| 77 61 72 65 20 6f 6e 20 | 74 68 65 20 6d 61 63 68 |ware on |the mach| |000007a0| 69 6e 65 20 64 6f 69 6e | 67 20 74 68 65 20 64 69 |ine doin|g the di| |000007b0| 73 70 6c 61 79 69 6e 67 | 20 69 73 20 74 68 65 20 |splaying| is the | |000007c0| 73 61 6d 65 20 61 73 20 | 6f 72 20 6c 61 74 65 72 |same as |or later| |000007d0| 20 74 68 61 6e 20 74 68 | 65 20 76 65 72 73 69 6f | than th|e versio| |000007e0| 6e 20 6f 6e 20 74 68 65 | 20 6d 61 63 68 69 6e 65 |n on the| machine| |000007f0| 20 74 68 61 74 20 63 72 | 65 61 74 65 64 20 74 68 | that cr|eated th| |00000800| 65 20 70 69 63 74 75 72 | 65 29 2e 20 46 6f 72 20 |e pictur|e). For | |00000810| 65 78 61 6d 70 6c 65 2c | 20 6f 6e 20 61 20 4d 61 |example,| on a Ma| |00000820| 63 69 6e 74 6f 73 68 20 | 50 6c 75 73 20 79 6f 75 |cintosh |Plus you| |00000830| 20 63 61 6e 20 64 72 61 | 77 20 61 20 50 49 43 54 | can dra|w a PICT| |00000840| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 61 6e 20 38 | contain|ing an 8| |00000850| 2d 62 69 74 20 69 6d 61 | 67 65 20 74 68 61 74 20 |-bit ima|ge that | |00000860| 77 61 73 20 63 72 65 61 | 74 65 64 20 6f 6e 20 61 |was crea|ted on a| |00000870| 0d 0d 4d 61 63 69 6e 74 | 6f 73 68 20 49 49 2e 20 |..Macint|osh II. | |00000880| 57 69 74 68 20 53 79 73 | 74 65 6d 20 37 2c 20 79 |With Sys|tem 7, y| |00000890| 6f 75 20 63 61 6e 20 65 | 76 65 6e 20 64 69 73 70 |ou can e|ven disp| |000008a0| 6c 61 79 20 50 49 43 54 | 73 20 63 6f 6e 74 61 69 |lay PICT|s contai| |000008b0| 6e 69 6e 67 20 31 36 2d | 62 69 74 20 61 6e 64 20 |ning 16-|bit and | |000008c0| 33 32 2d 62 69 74 20 70 | 69 78 4d 61 70 73 20 6f |32-bit p|ixMaps o| |000008d0| 6e 20 6d 61 63 68 69 6e | 65 73 20 77 69 74 68 20 |n machin|es with | |000008e0| 6f 72 69 67 69 6e 61 6c | 20 51 75 69 63 6b 44 72 |original| QuickDr| |000008f0| 61 77 2e 20 28 4f 66 20 | 63 6f 75 72 73 65 2c 20 |aw. (Of |course, | |00000900| 74 68 65 79 20 77 69 6c | 6c 20 6f 6e 6c 79 20 62 |they wil|l only b| |00000910| 65 20 64 69 73 70 6c 61 | 79 65 64 20 61 73 20 31 |e displa|yed as 1| |00000920| 2d 62 69 74 20 69 6d 61 | 67 65 73 20 74 68 65 72 |-bit ima|ges ther| |00000930| 65 2e 29 0d 43 72 65 61 | 74 69 6e 67 20 61 20 70 |e.).Crea|ting a p| |00000940| 69 63 74 75 72 65 20 6e | 6f 72 6d 61 6c 6c 79 20 |icture n|ormally | |00000950| 72 65 71 75 69 72 65 73 | 20 74 68 72 65 65 20 73 |requires| three s| |00000960| 74 65 70 73 3a 0d 31 2e | 09 43 61 6c 6c 20 4f 70 |teps:.1.|.Call Op| |00000970| 65 6e 50 69 63 74 75 72 | 65 20 74 6f 20 62 65 67 |enPictur|e to beg| |00000980| 69 6e 20 70 69 63 74 75 | 72 65 20 72 65 63 6f 72 |in pictu|re recor| |00000990| 64 69 6e 67 2e 0d 32 2e | 09 50 65 72 66 6f 72 6d |ding..2.|.Perform| |000009a0| 20 74 68 65 20 64 72 61 | 77 69 6e 67 20 63 6f 6d | the dra|wing com| |000009b0| 6d 61 6e 64 73 20 79 6f | 75 20 77 61 6e 74 20 74 |mands yo|u want t| |000009c0| 6f 20 72 65 63 6f 72 64 | 2e 0d 33 2e 09 43 61 6c |o record|..3..Cal| |000009d0| 6c 20 43 6c 6f 73 65 50 | 69 63 74 75 72 65 20 74 |l CloseP|icture t| |000009e0| 6f 20 65 6e 64 20 70 69 | 63 74 75 72 65 20 72 65 |o end pi|cture re| |000009f0| 63 6f 72 64 69 6e 67 2e | 0d 54 68 65 20 63 61 74 |cording.|.The cat| |00000a00| 63 68 20 69 73 20 74 68 | 61 74 20 74 68 65 20 6f |ch is th|at the o| |00000a10| 6e 6c 79 20 64 72 61 77 | 69 6e 67 20 63 6f 6d 6d |nly draw|ing comm| |00000a20| 61 6e 64 73 20 74 68 61 | 74 20 63 61 6e 20 62 65 |ands tha|t can be| |00000a30| 20 72 65 63 6f 72 64 65 | 64 20 69 6e 74 6f 20 61 | recorde|d into a| |00000a40| 20 70 69 63 74 75 72 65 | 20 61 72 65 20 74 68 6f | picture| are tho| |00000a50| 73 65 20 61 76 61 69 6c | 61 62 6c 65 20 6f 6e 20 |se avail|able on | |00000a60| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 6f 6e |the Maci|ntosh on| |00000a70| 20 77 68 69 63 68 20 79 | 6f 75 72 20 61 70 70 6c | which y|our appl| |00000a80| 69 63 61 74 69 6f 6e 20 | 69 73 20 72 75 6e 6e 69 |ication |is runni| |00000a90| 6e 67 2e 20 54 68 75 73 | 2c 20 75 73 69 6e 67 20 |ng. Thus|, using | |00000aa0| 74 68 69 73 20 70 72 6f | 63 65 64 75 72 65 20 6f |this pro|cedure o| |00000ab0| 6e 20 61 20 6d 61 63 68 | 69 6e 65 20 77 69 74 68 |n a mach|ine with| |00000ac0| 20 6f 72 69 67 69 6e 61 | 6c 20 51 75 69 63 6b 44 | origina|l QuickD| |00000ad0| 72 61 77 20 70 72 6f 76 | 69 64 65 73 20 6e 6f 20 |raw prov|ides no | |00000ae0| 77 61 79 20 74 6f 20 73 | 61 76 65 20 63 6f 6c 6f |way to s|ave colo| |00000af0| 72 20 70 69 78 4d 61 70 | 73 20 69 6e 74 6f 20 61 |r pixMap|s into a| |00000b00| 20 70 69 63 74 75 72 65 | 2c 20 73 69 6e 63 65 20 | picture|, since | |00000b10| 74 68 65 72 65 d5 73 20 | 6e 6f 20 63 61 6c 6c 20 |there.s |no call | |00000b20| 74 6f 20 64 72 61 77 20 | 61 20 70 69 78 4d 61 70 |to draw |a pixMap| |00000b30| 2e 20 49 6e 20 6f 74 68 | 65 72 20 77 6f 72 64 73 |. In oth|er words| |00000b40| 2c 20 79 6f 75 20 63 61 | 6e d5 74 20 63 72 65 61 |, you ca|n.t crea| |00000b50| 74 65 20 61 6e 20 38 2d | 62 69 74 20 50 49 43 54 |te an 8-|bit PICT| |00000b60| 20 6f 6e 20 61 20 4d 61 | 63 69 6e 74 6f 73 68 20 | on a Ma|cintosh | |00000b70| 50 6c 75 73 20 61 6e 64 | 20 73 65 65 20 69 74 20 |Plus and| see it | |00000b80| 69 6e 20 63 6f 6c 6f 72 | 20 6f 6e 20 61 20 4d 61 |in color| on a Ma| |00000b90| 63 69 6e 74 6f 73 68 20 | 49 49 2e 20 42 75 74 20 |cintosh |II. But | |00000ba0| 74 68 61 74 d5 73 20 65 | 78 61 63 74 6c 79 20 77 |that.s e|xactly w| |00000bb0| 68 61 74 20 77 6f 75 6c | 64 20 6d 61 6b 65 20 61 |hat woul|d make a| |00000bc0| 20 64 65 76 65 6c 6f 70 | 65 72 d5 73 20 6c 69 66 | develop|er.s lif| |00000bd0| 65 20 65 61 73 69 65 72 | d1 74 68 65 20 61 62 69 |e easier|.the abi| |00000be0| 6c 69 74 79 20 74 6f 20 | 63 72 65 61 74 65 20 61 |lity to |create a| |00000bf0| 20 50 49 43 54 20 63 6f | 6e 74 61 69 6e 69 6e 67 | PICT co|ntaining| |00000c00| 20 64 65 65 70 20 70 69 | 78 4d 61 70 20 69 6e 66 | deep pi|xMap inf| |00000c10| 6f 72 6d 61 74 69 6f 6e | 20 6f 6e 20 61 20 6d 61 |ormation| on a ma| |00000c20| 63 68 69 6e 65 20 77 69 | 74 68 6f 75 74 20 43 6f |chine wi|thout Co| |00000c30| 6c 6f 72 20 51 75 69 63 | 6b 44 72 61 77 2e 20 57 |lor Quic|kDraw. W| |00000c40| 69 74 68 20 74 68 69 73 | 20 61 62 69 6c 69 74 79 |ith this| ability| |00000c50| 2c 20 79 6f 75 20 63 6f | 75 6c 64 20 63 61 70 74 |, you co|uld capt| |00000c60| 75 72 65 20 61 20 63 6f | 6c 6f 72 20 69 6d 61 67 |ure a co|lor imag| |00000c70| 65 20 69 6e 20 69 74 73 | 20 66 75 6c 6c 20 67 6c |e in its| full gl| |00000c80| 6f 72 79 20 66 6f 72 20 | 73 6f 6d 65 6f 6e 65 20 |ory for |someone | |00000c90| 77 69 74 68 20 61 20 43 | 6f 6c 6f 72 20 51 75 69 |with a C|olor Qui| |00000ca0| 63 6b 44 72 61 77 20 6d | 61 63 68 69 6e 65 20 74 |ckDraw m|achine t| |00000cb0| 6f 20 73 65 65 2c 20 77 | 68 69 6c 65 20 73 74 69 |o see, w|hile sti| |00000cc0| 6c 6c 20 62 65 69 6e 67 | 20 61 62 6c 65 20 74 6f |ll being| able to| |00000cd0| 20 64 69 73 70 6c 61 79 | 20 61 20 31 2d 62 69 74 | display| a 1-bit| |00000ce0| 20 76 65 72 73 69 6f 6e | 20 6f 6e 20 61 20 6d 61 | version| on a ma| |00000cf0| 63 68 69 6e 65 20 77 69 | 74 68 20 6f 72 69 67 69 |chine wi|th origi| |00000d00| 6e 61 6c 20 51 75 69 63 | 6b 44 72 61 77 2e 0d 54 |nal Quic|kDraw..T| |00000d10| 6f 20 67 65 74 20 61 72 | 6f 75 6e 64 20 74 68 65 |o get ar|ound the| |00000d20| 20 6c 69 6d 69 74 61 74 | 69 6f 6e 73 20 6f 66 20 | limitat|ions of | |00000d30| 74 68 65 20 6e 6f 72 6d | 61 6c 20 70 72 6f 63 65 |the norm|al proce| |00000d40| 64 75 72 65 2c 20 77 65 | 20 63 61 6d 65 20 75 70 |dure, we| came up| |00000d50| 20 77 69 74 68 20 61 20 | 72 6f 75 74 69 6e 65 20 | with a |routine | |00000d60| 63 61 6c 6c 65 64 20 43 | 72 65 61 74 65 50 49 43 |called C|reatePIC| |00000d70| 54 32 20 74 6f 20 6d 61 | 6e 75 61 6c 6c 79 20 63 |T2 to ma|nually c| |00000d80| 72 65 61 74 65 20 61 20 | 50 49 43 54 20 63 6f 6e |reate a |PICT con| |00000d90| 74 61 69 6e 69 6e 67 20 | 63 6f 6c 6f 72 20 69 6e |taining |color in| |00000da0| 66 6f 72 6d 61 74 69 6f | 6e 2e 20 59 6f 75 72 20 |formatio|n. Your | |00000db0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 63 61 6e 20 |applicat|ion can | |00000dc0| 64 69 73 70 6c 61 79 20 | 74 68 65 20 70 69 63 74 |display |the pict| |00000dd0| 75 72 65 20 75 73 69 6e | 67 20 44 72 61 77 50 69 |ure usin|g DrawPi| |00000de0| 63 74 75 72 65 2e 20 4e | 6f 77 2c 20 79 6f 75 20 |cture. N|ow, you | |00000df0| 6d 61 79 20 62 65 20 77 | 6f 6e 64 65 72 69 6e 67 |may be w|ondering| |00000e00| 20 77 68 65 74 68 65 72 | 20 63 72 65 61 74 69 6e | whether| creatin| |00000e10| 67 20 79 6f 75 72 20 6f | 77 6e 20 70 69 63 74 75 |g your o|wn pictu| |00000e20| 72 65 73 20 69 73 20 61 | 64 76 69 73 61 62 6c 65 |res is a|dvisable| |00000e30| 2e 20 41 66 74 65 72 20 | 61 6c 6c 2c 20 41 70 70 |. After |all, App| |00000e40| 6c 65 20 66 72 6f 77 6e | 73 20 6f 6e 20 64 65 76 |le frown|s on dev| |00000e50| 65 6c 6f 70 65 72 73 20 | 77 68 6f 20 64 69 72 65 |elopers |who dire| |00000e60| 63 74 6c 79 20 6d 6f 64 | 69 66 79 20 70 72 69 76 |ctly mod|ify priv| |00000e70| 61 74 65 20 64 61 74 61 | 20 73 74 72 75 63 74 75 |ate data| structu| |00000e80| 72 65 73 2c 20 61 6e 64 | 20 69 73 6e d5 74 20 74 |res, and| isn.t t| |00000e90| 68 61 74 20 77 68 61 74 | d5 73 20 67 6f 69 6e 67 |hat what|.s going| |00000ea0| 20 6f 6e 20 68 65 72 65 | 3f 20 54 6f 20 65 61 73 | on here|? To eas| |00000eb0| 65 20 79 6f 75 72 20 6d | 69 6e 64 2c 20 73 65 65 |e your m|ind, see| |00000ec0| 20 d2 42 75 74 20 44 6f | 6e d5 74 20 49 20 4e 65 | .But Do|n.t I Ne| |00000ed0| 65 64 20 61 20 4c 69 63 | 65 6e 73 65 20 74 6f 20 |ed a Lic|ense to | |00000ee0| 44 6f 20 54 68 69 73 3f | d3 0d 54 68 65 20 70 61 |Do This?|..The pa| |00000ef0| 72 61 6d 65 74 65 72 73 | 20 74 6f 20 43 72 65 61 |rameters| to Crea| |00000f00| 74 65 50 49 43 54 32 20 | 61 72 65 20 73 69 6d 69 |tePICT2 |are simi| |00000f10| 6c 61 72 20 74 6f 20 74 | 68 6f 73 65 20 66 6f 72 |lar to t|hose for| |00000f20| 20 74 68 65 20 51 75 69 | 63 6b 44 72 61 77 20 62 | the Qui|ckDraw b| |00000f30| 6f 74 74 6c 65 6e 65 63 | 6b 20 70 72 6f 63 65 64 |ottlenec|k proced| |00000f40| 75 72 65 20 73 74 64 42 | 69 74 73 2e 20 54 68 65 |ure stdB|its. The| |00000f50| 20 64 69 66 66 65 72 65 | 6e 63 65 20 69 73 20 74 | differe|nce is t| |00000f60| 68 61 74 20 43 72 65 61 | 74 65 50 49 43 54 32 20 |hat Crea|tePICT2 | |00000f70| 72 65 74 75 72 6e 73 20 | 61 20 50 69 63 48 61 6e |returns |a PicHan| |00000f80| 64 6c 65 20 61 6e 64 20 | 64 6f 65 73 20 6e 6f 74 |dle and |does not| |00000f90| 20 75 73 65 20 61 20 6d | 61 73 6b 52 67 6e 2e 0d | use a m|askRgn..| |00000fa0| 54 68 65 20 66 69 72 73 | 74 20 74 68 69 6e 67 20 |The firs|t thing | |00000fb0| 74 68 65 20 72 6f 75 74 | 69 6e 65 20 64 6f 65 73 |the rout|ine does| |00000fc0| 20 69 73 20 63 61 6c 63 | 75 6c 61 74 65 20 61 20 | is calc|ulate a | |00000fd0| 77 6f 72 73 74 2d 63 61 | 73 65 20 6d 65 6d 6f 72 |worst-ca|se memor| |00000fe0| 79 20 73 63 65 6e 61 72 | 69 6f 20 61 6e 64 20 61 |y scenar|io and a| |00000ff0| 6c 6c 6f 63 61 74 65 20 | 74 68 61 74 20 61 6d 6f |llocate |that amo| |00001000| 75 6e 74 20 6f 66 20 73 | 74 6f 72 61 67 65 2e 20 |unt of s|torage. | |00001010| 49 66 20 74 68 65 20 6d | 65 6d 6f 72 79 20 69 73 |If the m|emory is| |00001020| 6e d5 74 20 61 76 61 69 | 6c 61 62 6c 65 2c 20 74 |n.t avai|lable, t| |00001030| 68 65 20 72 6f 75 74 69 | 6e 65 20 61 62 6f 72 74 |he routi|ne abort| |00001040| 73 2c 20 72 65 74 75 72 | 6e 69 6e 67 20 61 20 4e |s, retur|ning a N| |00001050| 49 4c 20 50 69 63 48 61 | 6e 64 6c 65 2e 20 59 6f |IL PicHa|ndle. Yo| |00001060| 75 20 63 6f 75 6c 64 20 | 65 61 73 69 6c 79 20 65 |u could |easily e| |00001070| 78 74 65 6e 64 20 74 68 | 69 73 20 72 6f 75 74 69 |xtend th|is routi| |00001080| 6e 65 20 74 6f 20 73 70 | 6f 6f 6c 20 74 68 65 20 |ne to sp|ool the | |00001090| 70 69 63 74 75 72 65 20 | 74 6f 20 64 69 73 6b 20 |picture |to disk | |000010a0| 69 66 20 74 68 65 20 6d | 65 6d 6f 72 79 20 69 73 |if the m|emory is| |000010b0| 20 6e 6f 74 20 61 76 61 | 69 6c 61 62 6c 65 2c 20 | not ava|ilable, | |000010c0| 62 75 74 20 74 68 61 74 | d5 73 20 6c 65 66 74 20 |but that|.s left | |000010d0| 61 73 20 61 6e 20 65 78 | 65 72 63 69 73 65 20 66 |as an ex|ercise f| |000010e0| 6f 72 20 79 6f 75 2e 20 | 28 48 69 6e 74 3a 20 52 |or you. |(Hint: R| |000010f0| 61 74 68 65 72 20 74 68 | 61 6e 20 77 72 69 74 69 |ather th|an writi| |00001100| 6e 67 20 6f 75 74 20 74 | 68 65 20 64 61 74 61 20 |ng out t|he data | |00001110| 69 6e 6c 69 6e 65 20 61 | 73 20 69 73 20 64 6f 6e |inline a|s is don| |00001120| 65 20 68 65 72 65 2c 20 | 63 61 6c 6c 20 61 20 66 |e here, |call a f| |00001130| 75 6e 63 74 69 6f 6e 20 | 74 68 61 74 20 73 61 76 |unction |that sav| |00001140| 65 73 20 61 20 73 70 65 | 63 69 66 69 65 64 20 6e |es a spe|cified n| |00001150| 75 6d 62 65 72 20 6f 66 | 20 62 79 74 65 73 20 69 |umber of| bytes i| |00001160| 6e 20 74 68 65 20 70 69 | 63 74 75 72 65 2e 20 48 |n the pi|cture. H| |00001170| 61 76 65 20 74 68 61 74 | 20 72 6f 75 74 69 6e 65 |ave that| routine| |00001180| 20 77 72 69 74 65 20 74 | 68 65 20 64 61 74 61 20 | write t|he data | |00001190| 74 6f 20 64 69 73 6b 2e | 20 45 73 73 65 6e 74 69 |to disk.| Essenti| |000011a0| 61 6c 6c 79 2c 20 79 6f | 75 20 6e 65 65 64 20 61 |ally, yo|u need a| |000011b0| 6e 20 65 71 75 69 76 61 | 6c 65 6e 74 20 74 6f 20 |n equiva|lent to | |000011c0| 74 68 65 20 70 75 74 50 | 69 63 44 61 74 61 20 62 |the putP|icData b| |000011d0| 6f 74 74 6c 65 6e 65 63 | 6b 2e 29 0d 41 74 20 74 |ottlenec|k.).At t| |000011e0| 68 69 73 20 70 6f 69 6e | 74 20 74 68 65 20 73 69 |his poin|t the si| |000011f0| 7a 65 20 6f 66 20 74 68 | 65 20 70 69 63 74 75 72 |ze of th|e pictur| |00001200| 65 20 69 73 20 6e 6f 74 | 20 6b 6e 6f 77 6e 20 28 |e is not| known (| |00001210| 73 69 6e 63 65 20 74 68 | 65 72 65 d5 73 20 6e 6f |since th|ere.s no| |00001220| 20 77 61 79 20 74 6f 20 | 6b 6e 6f 77 20 68 6f 77 | way to |know how| |00001230| 20 77 65 6c 6c 20 74 68 | 65 20 70 69 78 4d 61 70 | well th|e pixMap| |00001240| 20 77 69 6c 6c 20 63 6f | 6d 70 72 65 73 73 29 20 | will co|mpress) | |00001250| 73 6f 20 77 65 20 73 69 | 6d 70 6c 79 20 73 6b 69 |so we si|mply ski| |00001260| 70 20 74 68 65 20 70 69 | 63 53 69 7a 65 20 66 69 |p the pi|cSize fi| |00001270| 65 6c 64 20 61 6e 64 20 | 70 75 74 20 6f 75 74 20 |eld and |put out | |00001280| 74 68 65 20 70 69 63 74 | 75 72 65 20 66 72 61 6d |the pict|ure fram| |00001290| 65 2e 20 4e 65 78 74 20 | 69 73 20 74 68 65 20 70 |e. Next |is the p| |000012a0| 69 63 48 65 61 64 65 72 | 2e 20 43 72 65 61 74 65 |icHeader|. Create| |000012b0| 50 49 43 54 32 20 63 72 | 65 61 74 65 73 20 76 65 |PICT2 cr|eates ve| |000012c0| 72 73 69 6f 6e 20 24 30 | 32 46 46 20 70 69 63 74 |rsion $0|2FF pict| |000012d0| 75 72 65 73 2c 20 77 69 | 74 68 20 61 20 68 65 61 |ures, wi|th a hea| |000012e0| 64 65 72 20 74 68 61 74 | 20 68 61 73 20 76 65 72 |der that| has ver| |000012f0| 73 69 6f 6e 20 24 46 46 | 46 46 2e 20 54 68 69 73 |sion $FF|FF. This| |00001300| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 74 68 65 20 | version| of the | |00001310| 68 65 61 64 65 72 20 74 | 65 6c 6c 73 20 51 75 69 |header t|ells Qui| |00001320| 63 6b 44 72 61 77 20 74 | 6f 20 69 67 6e 6f 72 65 |ckDraw t|o ignore| |00001330| 20 74 68 65 20 68 65 61 | 64 65 72 20 64 61 74 61 | the hea|der data| |00001340| 2e 20 28 4f 70 65 6e 43 | 50 69 63 74 75 72 65 2c |. (OpenC|Picture,| |00001350| 20 61 76 61 69 6c 61 62 | 6c 65 20 6f 72 69 67 69 | availab|le origi| |00001360| 6e 61 6c 6c 79 20 69 6e | 20 33 32 2d 42 69 74 20 |nally in| 32-Bit | |00001370| 51 75 69 63 6b 44 72 61 | 77 20 0d 0d 42 55 54 20 |QuickDra|w ..BUT | |00001380| 44 4f 4e d5 54 20 49 20 | 4e 45 45 44 20 41 20 4c |DON.T I |NEED A L| |00001390| 49 43 45 4e 53 45 20 54 | 4f 20 44 4f 20 54 48 49 |ICENSE T|O DO THI| |000013a0| 53 3f 09 0d 54 68 65 20 | 72 65 61 73 6f 6e 20 41 |S?..The |reason A| |000013b0| 70 70 6c 65 20 64 6f 65 | 73 6e d5 74 20 77 61 6e |pple doe|sn.t wan| |000013c0| 74 20 64 65 76 65 6c 6f | 70 65 72 73 20 6d 6f 64 |t develo|pers mod| |000013d0| 69 66 79 69 6e 67 20 64 | 61 74 61 20 73 74 72 75 |ifying d|ata stru| |000013e0| 63 74 75 72 65 73 20 69 | 73 20 74 68 61 74 20 69 |ctures i|s that i| |000013f0| 74 20 6d 61 6b 65 73 20 | 69 74 20 68 61 72 64 20 |t makes |it hard | |00001400| 74 6f 20 63 68 61 6e 67 | 65 20 74 68 65 6d 20 69 |to chang|e them i| |00001410| 6e 20 74 68 65 20 66 75 | 74 75 72 65 2e 20 46 6f |n the fu|ture. Fo| |00001420| 72 20 65 78 61 6d 70 6c | 65 2c 20 65 61 72 6c 79 |r exampl|e, early| |00001430| 20 4d 61 63 69 6e 74 6f | 73 68 20 70 72 6f 67 72 | Macinto|sh progr| |00001440| 61 6d 73 20 6c 6f 63 6b | 65 64 20 68 61 6e 64 6c |ams lock|ed handl| |00001450| 65 73 20 62 79 20 6d 61 | 6e 75 61 6c 6c 79 20 73 |es by ma|nually s| |00001460| 65 74 74 69 6e 67 20 74 | 68 65 20 68 69 67 68 20 |etting t|he high | |00001470| 62 69 74 20 6f 66 20 74 | 68 65 20 68 61 6e 64 6c |bit of t|he handl| |00001480| 65 20 72 61 74 68 65 72 | 20 74 68 61 6e 20 63 61 |e rather| than ca| |00001490| 6c 6c 69 6e 67 20 48 4c | 6f 63 6b 2e 20 54 68 69 |lling HL|ock. Thi| |000014a0| 73 20 63 61 75 73 65 64 | 20 6e 75 6d 65 72 6f 75 |s caused| numerou| |000014b0| 73 20 63 6f 6d 70 61 74 | 69 62 69 6c 69 74 79 20 |s compat|ibility | |000014c0| 70 72 6f 62 6c 65 6d 73 | 20 77 68 65 6e 20 74 68 |problems| when th| |000014d0| 65 20 33 32 2d 62 69 74 | 2d 63 6c 65 61 6e 20 4d |e 32-bit|-clean M| |000014e0| 65 6d 6f 72 79 20 4d 61 | 6e 61 67 65 72 20 77 61 |emory Ma|nager wa| |000014f0| 73 20 69 6e 74 72 6f 64 | 75 63 65 64 2e 0d 53 6f |s introd|uced..So| |00001500| 20 77 68 61 74 20 67 69 | 76 65 73 3f 20 57 68 61 | what gi|ves? Wha| |00001510| 74 20 69 66 20 41 70 70 | 6c 65 20 63 68 61 6e 67 |t if App|le chang| |00001520| 65 73 20 4f 70 65 6e 50 | 69 63 74 75 72 65 20 73 |es OpenP|icture s| |00001530| 6f 20 74 68 61 74 20 69 | 74 20 63 72 65 61 74 65 |o that i|t create| |00001540| 73 20 61 20 74 6f 74 61 | 6c 6c 79 20 64 69 66 66 |s a tota|lly diff| |00001550| 65 72 65 6e 74 20 64 61 | 74 61 20 66 6f 72 6d 61 |erent da|ta forma| |00001560| 74 d1 77 6f 6e d5 74 20 | 74 68 65 20 6d 61 6e 75 |t.won.t |the manu| |00001570| 61 6c 6c 79 20 63 72 65 | 61 74 65 64 20 70 69 63 |ally cre|ated pic| |00001580| 74 75 72 65 73 20 62 72 | 65 61 6b 3f 0d 43 61 6c |tures br|eak?.Cal| |00001590| 6d 20 64 6f 77 6e 2c 20 | 62 65 63 61 75 73 65 20 |m down, |because | |000015a0| 74 68 65 20 61 6e 73 77 | 65 72 20 69 73 20 6e 6f |the answ|er is no| |000015b0| 2e 20 54 68 65 20 64 69 | 66 66 65 72 65 6e 63 65 |. The di|fference| |000015c0| 20 62 65 74 77 65 65 6e | 20 63 72 65 61 74 69 6e | between| creatin| |000015d0| 67 20 79 6f 75 72 20 6f | 77 6e 20 70 69 63 74 75 |g your o|wn pictu| |000015e0| 72 65 73 20 61 6e 64 20 | 64 69 72 65 63 74 6c 79 |res and |directly| |000015f0| 20 6d 6f 64 69 66 79 69 | 6e 67 20 6f 74 68 65 72 | modifyi|ng other| |00001600| 20 64 61 74 61 20 73 74 | 72 75 63 74 75 72 65 73 | data st|ructures| |00001610| 20 69 73 20 74 68 61 74 | 20 41 70 70 6c 65 20 63 | is that| Apple c| |00001620| 61 6e d5 74 20 6d 61 6b | 65 20 74 68 65 20 63 75 |an.t mak|e the cu| |00001630| 72 72 65 6e 74 20 70 69 | 63 74 75 72 65 20 64 61 |rrent pi|cture da| |00001640| 74 61 20 66 6f 72 6d 61 | 74 20 6f 62 73 6f 6c 65 |ta forma|t obsole| |00001650| 74 65 20 77 69 74 68 6f | 75 74 20 69 6e 76 61 6c |te witho|ut inval| |00001660| 69 64 61 74 69 6e 67 20 | 75 73 65 72 73 d5 20 64 |idating |users. d| |00001670| 61 74 61 20 74 68 61 74 | 20 65 78 69 73 74 73 20 |ata that| exists | |00001680| 6f 6e 20 64 69 73 6b 2e | 20 4a 75 73 74 20 61 73 |on disk.| Just as| |00001690| 20 79 6f 75 20 63 61 6e | 20 73 74 69 6c 6c 20 63 | you can| still c| |000016a0| 61 6c 6c 20 44 72 61 77 | 50 69 63 74 75 72 65 20 |all Draw|Picture | |000016b0| 6f 6e 20 76 65 72 73 69 | 6f 6e 20 31 20 70 69 63 |on versi|on 1 pic| |000016c0| 74 75 72 65 73 20 61 6e | 64 20 65 76 65 72 79 74 |tures an|d everyt| |000016d0| 68 69 6e 67 20 77 6f 72 | 6b 73 2c 20 79 6f 75 20 |hing wor|ks, you | |000016e0| 77 69 6c 6c 20 61 6c 77 | 61 79 73 20 62 65 20 61 |will alw|ays be a| |000016f0| 62 6c 65 20 74 6f 20 63 | 61 6c 6c 20 44 72 61 77 |ble to c|all Draw| |00001700| 50 69 63 74 75 72 65 20 | 6f 6e 20 65 78 69 73 74 |Picture |on exist| |00001710| 69 6e 67 20 76 65 72 73 | 69 6f 6e 20 32 20 70 69 |ing vers|ion 2 pi| |00001720| 63 74 75 72 65 73 2c 20 | 72 65 67 61 72 64 6c 65 |ctures, |regardle| |00001730| 73 73 20 6f 66 20 74 68 | 65 20 66 6f 72 6d 61 74 |ss of th|e format| |00001740| 20 6f 66 20 70 69 63 74 | 75 72 65 73 20 63 72 65 | of pict|ures cre| |00001750| 61 74 65 64 20 69 6e 20 | 74 68 65 20 66 75 74 75 |ated in |the futu| |00001760| 72 65 2e 09 4f 6e 65 20 | 70 6f 73 73 69 62 6c 65 |re..One |possible| |00001770| 20 70 69 74 66 61 6c 6c | 20 69 73 20 74 68 61 74 | pitfall| is that| |00001780| 20 79 6f 75 20 6d 69 67 | 68 74 20 63 72 65 61 74 | you mig|ht creat| |00001790| 65 20 61 20 70 69 63 74 | 75 72 65 20 77 69 74 68 |e a pict|ure with| |000017a0| 20 73 75 62 74 6c 65 20 | 63 6f 6d 70 61 74 69 62 | subtle |compatib| |000017b0| 69 6c 69 74 79 20 72 69 | 73 6b 73 20 74 68 61 74 |ility ri|sks that| |000017c0| 20 64 72 61 77 73 20 6f | 6e 20 74 68 65 20 65 78 | draws o|n the ex| |000017d0| 69 73 74 69 6e 67 20 73 | 79 73 74 65 6d 20 73 6f |isting s|ystem so| |000017e0| 66 74 77 61 72 65 20 62 | 75 74 20 62 72 65 61 6b |ftware b|ut break| |000017f0| 73 20 61 74 20 73 6f 6d | 65 20 66 75 74 75 72 65 |s at som|e future| |00001800| 20 64 61 74 65 2e 20 54 | 6f 20 6d 69 6e 69 6d 69 | date. T|o minimi| |00001810| 7a 65 20 74 68 65 20 63 | 68 61 6e 63 65 73 20 6f |ze the c|hances o| |00001820| 66 20 73 75 63 68 20 61 | 6e 20 6f 63 63 75 72 72 |f such a|n occurr| |00001830| 65 6e 63 65 2c 20 79 6f | 75 20 73 68 6f 75 6c 64 |ence, yo|u should| |00001840| 20 63 6f 6d 70 61 72 65 | 20 74 68 65 20 70 69 63 | compare| the pic| |00001850| 74 75 72 65 73 20 79 6f | 75 20 67 65 6e 65 72 61 |tures yo|u genera| |00001860| 74 65 20 77 69 74 68 20 | 74 68 6f 73 65 20 74 68 |te with |those th| |00001870| 61 74 20 51 75 69 63 6b | 44 72 61 77 20 67 65 6e |at Quick|Draw gen| |00001880| 65 72 61 74 65 73 20 69 | 6e 20 69 64 65 6e 74 69 |erates i|n identi| |00001890| 63 61 6c 20 63 69 72 63 | 75 6d 73 74 61 6e 63 65 |cal circ|umstance| |000018a0| 73 2e 20 59 6f 75 20 6d | 75 73 74 20 62 65 20 61 |s. You m|ust be a| |000018b0| 62 6c 65 20 74 6f 20 61 | 63 63 6f 75 6e 74 20 66 |ble to a|ccount f| |000018c0| 6f 72 20 61 6e 79 20 61 | 6e 64 20 61 6c 6c 20 64 |or any a|nd all d| |000018d0| 69 66 66 65 72 65 6e 63 | 65 73 2e 0d 43 72 65 61 |ifferenc|es..Crea| |000018e0| 74 69 6e 67 20 79 6f 75 | 72 20 6f 77 6e 20 70 69 |ting you|r own pi| |000018f0| 78 4d 61 70 73 20 28 61 | 73 20 6f 75 72 20 65 78 |xMaps (a|s our ex| |00001900| 61 6d 70 6c 65 20 63 6f | 64 65 20 64 6f 65 73 29 |ample co|de does)| |00001910| 0d 20 69 73 20 64 65 66 | 69 6e 69 74 65 6c 79 20 |. is def|initely | |00001920| 69 6e 20 74 68 65 20 67 | 72 61 79 20 61 72 65 61 |in the g|ray area| |00001930| 20 62 65 74 77 65 65 6e | 20 72 69 73 6b 79 20 61 | between| risky a| |00001940| 6e 64 20 6f 75 74 72 69 | 67 68 74 20 64 69 73 61 |nd outri|ght disa| |00001950| 73 74 72 6f 75 73 20 62 | 65 68 61 76 69 6f 72 2c |strous b|ehavior,| |00001960| 20 61 6e 64 20 79 6f 75 | 20 73 68 6f 75 6c 64 6e | and you| shouldn| |00001970| d5 74 20 64 6f 20 69 74 | 2e 20 54 68 65 6e 20 77 |.t do it|. Then w| |00001980| 68 79 20 77 6f 75 6c 64 | 20 61 6e 20 61 72 74 69 |hy would| an arti| |00001990| 63 6c 65 20 77 72 69 74 | 74 65 6e 20 62 79 20 74 |cle writ|ten by t| |000019a0| 77 6f 20 75 70 73 74 61 | 6e 64 69 6e 67 20 63 69 |wo upsta|nding ci| |000019b0| 74 69 7a 65 6e 73 20 64 | 6f 20 0d 73 75 63 68 20 |tizens d|o .such | |000019c0| 61 20 74 68 69 6e 67 3f | 20 54 68 65 20 61 6e 73 |a thing?| The ans| |000019d0| 77 65 72 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |wer is t|hat the | |000019e0| 70 69 78 4d 61 70 73 20 | 75 73 65 64 20 62 79 20 |pixMaps |used by | |000019f0| 74 68 69 73 20 63 6f 64 | 65 20 61 72 65 20 6b 65 |this cod|e are ke| |00001a00| 70 74 20 70 72 69 76 61 | 74 65 3b 20 74 68 65 79 |pt priva|te; they| |00001a10| d5 72 65 20 6e 65 76 65 | 72 20 70 61 73 73 65 64 |.re neve|r passed| |00001a20| 20 61 73 20 61 72 67 75 | 6d 65 6e 74 73 20 74 6f | as argu|ments to| |00001a30| 20 61 20 74 72 61 70 2e | 20 57 65 20 63 6f 75 6c | a trap.| We coul| |00001a40| 64 20 6a 75 73 74 20 61 | 73 20 65 61 73 69 6c 79 |d just a|s easily| |00001a50| 20 68 61 76 65 20 63 61 | 6c 6c 65 64 20 74 68 65 | have ca|lled the| |00001a60| 6d 20 73 6f 6d 65 74 68 | 69 6e 67 20 65 6c 73 65 |m someth|ing else| |00001a70| 2c 20 62 75 74 20 70 69 | 78 4d 61 70 73 20 77 6f |, but pi|xMaps wo| |00001a80| 72 6b 20 66 6f 72 20 77 | 68 61 74 20 77 65 d5 72 |rk for w|hat we.r| |00001a90| 65 20 64 6f 69 6e 67 2c | 20 0d 73 6f 20 77 65 20 |e doing,| .so we | |00001aa0| 75 73 65 64 20 74 68 65 | 6d 2e 20 49 66 20 79 6f |used the|m. If yo| |00001ab0| 75 20 77 61 6e 74 20 74 | 6f 20 70 61 73 73 20 61 |u want t|o pass a| |00001ac0| 20 70 69 78 4d 61 70 20 | 74 6f 20 61 20 74 72 61 | pixMap |to a tra| |00001ad0| 70 2c 20 79 6f 75 20 63 | 61 6e 20 67 65 6e 65 72 |p, you c|an gener| |00001ae0| 61 74 65 20 69 74 20 75 | 73 69 6e 67 20 74 68 65 |ate it u|sing the| |00001af0| 20 4e 65 77 50 69 78 4d | 61 70 20 63 61 6c 6c 20 | NewPixM|ap call | |00001b00| 28 6e 6f 74 20 61 76 61 | 69 6c 61 62 6c 65 20 6f |(not ava|ilable o| |00001b10| 6e 20 6d 61 63 68 69 6e | 65 73 20 77 69 74 68 20 |n machin|es with | |00001b20| 6f 72 69 67 69 6e 61 6c | 20 51 75 69 63 6b 44 72 |original| QuickDr| |00001b30| 61 77 29 20 6f 72 20 6c | 65 74 20 0d 6f 74 68 65 |aw) or l|et .othe| |00001b40| 72 20 70 61 72 74 73 20 | 6f 66 20 43 6f 6c 6f 72 |r parts |of Color| |00001b50| 20 51 75 69 63 6b 44 72 | 61 77 2c 20 6c 69 6b 65 | QuickDr|aw, like| |00001b60| 20 4f 70 65 6e 43 50 6f | 72 74 2c 20 0d 67 65 6e | OpenCPo|rt, .gen| |00001b70| 65 72 61 74 65 20 69 74 | 2e 09 0d 76 65 72 73 69 |erate it|...versi| |00001b80| 6f 6e 20 31 2e 32 20 61 | 6e 64 20 69 6e 20 43 6f |on 1.2 a|nd in Co| |00001b90| 6c 6f 72 20 51 75 69 63 | 6b 44 72 61 77 20 69 6e |lor Quic|kDraw in| |00001ba0| 20 53 79 73 74 65 6d 20 | 37 2c 20 73 74 69 6c 6c | System |7, still| |00001bb0| 20 63 72 65 61 74 65 73 | 20 76 65 72 73 69 6f 6e | creates| version| |00001bc0| 20 24 30 32 46 46 20 70 | 69 63 74 75 72 65 73 2c | $02FF p|ictures,| |00001bd0| 20 62 75 74 20 74 68 65 | 20 68 65 61 64 65 72 20 | but the| header | |00001be0| 76 65 72 73 69 6f 6e 20 | 69 73 20 6e 6f 77 20 24 |version |is now $| |00001bf0| 46 46 46 45 20 61 6e 64 | 20 63 6f 6e 74 61 69 6e |FFFE and| contain| |00001c00| 73 20 70 69 63 74 75 72 | 65 20 72 65 73 6f 6c 75 |s pictur|e resolu| |00001c10| 74 69 6f 6e 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |tion inf|ormation| |00001c20| 2e 29 0d 49 6e 20 61 64 | 64 69 74 69 6f 6e 2c 20 |.).In ad|dition, | |00001c30| 74 68 65 20 62 6f 75 6e | 64 73 20 6f 66 20 74 68 |the boun|ds of th| |00001c40| 65 20 63 6c 69 70 70 69 | 6e 67 20 72 65 67 69 6f |e clippi|ng regio| |00001c50| 6e 20 6f 66 20 74 68 65 | 20 63 75 72 72 65 6e 74 |n of the| current| |00001c60| 20 70 6f 72 74 20 61 72 | 65 20 70 75 74 20 69 6e | port ar|e put in| |00001c70| 20 74 68 65 20 70 69 63 | 74 75 72 65 2e 20 57 69 | the pic|ture. Wi| |00001c80| 74 68 6f 75 74 20 74 68 | 69 73 2c 20 74 68 65 20 |thout th|is, the | |00001c90| 64 65 66 61 75 6c 74 20 | 63 6c 69 70 70 69 6e 67 |default |clipping| |00001ca0| 20 72 65 67 69 6f 6e 20 | 69 73 20 77 69 64 65 20 | region |is wide | |00001cb0| 6f 70 65 6e 2c 20 61 6e | 64 20 73 6f 6d 65 20 76 |open, an|d some v| |00001cc0| 65 72 73 69 6f 6e 73 20 | 6f 66 20 51 75 69 63 6b |ersions |of Quick| |00001cd0| 44 72 61 77 20 68 61 76 | 65 20 74 72 6f 75 62 6c |Draw hav|e troubl| |00001ce0| 65 20 64 72 61 77 69 6e | 67 20 70 69 63 74 75 72 |e drawin|g pictur| |00001cf0| 65 73 20 77 69 74 68 20 | 77 69 64 65 2d 6f 70 65 |es with |wide-ope| |00001d00| 6e 20 63 6c 69 70 70 69 | 6e 67 20 72 65 67 69 6f |n clippi|ng regio| |00001d10| 6e 73 2e 0d 4e 65 78 74 | 20 77 65 20 70 75 74 20 |ns..Next| we put | |00001d20| 6f 75 74 20 61 6e 20 6f | 70 63 6f 64 65 d1 65 69 |out an o|pcode.ei| |00001d30| 74 68 65 72 20 24 39 38 | 20 28 50 61 63 6b 42 69 |ther $98| (PackBi| |00001d40| 74 73 52 65 63 74 29 20 | 6f 72 20 24 39 41 20 28 |tsRect) |or $9A (| |00001d50| 44 69 72 65 63 74 42 69 | 74 73 52 65 63 74 29 2c |DirectBi|tsRect),| |00001d60| 20 64 65 70 65 6e 64 69 | 6e 67 20 6f 6e 20 77 68 | dependi|ng on wh| |00001d70| 65 74 68 65 72 20 74 68 | 65 20 70 69 78 4d 61 70 |ether th|e pixMap| |00001d80| 20 69 73 20 69 6e 64 65 | 78 65 64 20 6f 72 20 64 | is inde|xed or d| |00001d90| 69 72 65 63 74 2e 20 54 | 68 65 6e 20 74 68 65 20 |irect. T|hen the | |00001da0| 70 69 78 4d 61 70 2c 20 | 73 72 63 52 65 63 74 2c |pixMap, |srcRect,| |00001db0| 20 64 73 74 52 65 63 74 | 2c 20 61 6e 64 20 6d 6f | dstRect|, and mo| |00001dc0| 64 65 20 61 72 65 20 70 | 75 74 20 69 6e 20 74 68 |de are p|ut in th| |00001dd0| 65 20 70 69 63 74 75 72 | 65 20 75 73 69 6e 67 20 |e pictur|e using | |00001de0| 74 68 65 20 28 61 72 65 | 20 79 6f 75 20 72 65 61 |the (are| you rea| |00001df0| 64 79 20 66 6f 72 20 74 | 68 69 73 3f 29 20 50 75 |dy for t|his?) Pu| |00001e00| 74 4f 75 74 50 69 78 4d | 61 70 53 72 63 52 65 63 |tOutPixM|apSrcRec| |00001e10| 74 44 73 74 52 65 63 74 | 41 6e 64 4d 6f 64 65 20 |tDstRect|AndMode | |00001e20| 72 6f 75 74 69 6e 65 2e | 20 46 69 6e 61 6c 6c 79 |routine.| Finally| |00001e30| 2c 20 65 69 74 68 65 72 | 20 50 75 74 4f 75 74 50 |, either| PutOutP| |00001e40| 61 63 6b 65 64 44 69 72 | 65 63 74 50 69 78 44 61 |ackedDir|ectPixDa| |00001e50| 74 61 20 6f 72 20 50 75 | 74 4f 75 74 50 61 63 6b |ta or Pu|tOutPack| |00001e60| 65 64 49 6e 64 65 78 65 | 64 50 69 78 44 61 74 61 |edIndexe|dPixData| |00001e70| 20 69 73 20 63 61 6c 6c | 65 64 20 74 6f 20 70 75 | is call|ed to pu| |00001e80| 74 20 6f 75 74 20 74 68 | 65 20 70 69 78 65 6c 20 |t out th|e pixel | |00001e90| 64 61 74 61 2e 0d 54 68 | 65 72 65 d5 73 20 61 6e |data..Th|ere.s an| |00001ea0| 20 69 6d 70 6f 72 74 61 | 6e 74 20 64 69 66 66 65 | importa|nt diffe| |00001eb0| 72 65 6e 63 65 20 62 65 | 74 77 65 65 6e 20 69 6e |rence be|tween in| |00001ec0| 64 65 78 65 64 20 61 6e | 64 20 64 69 72 65 63 74 |dexed an|d direct| |00001ed0| 20 70 69 78 4d 61 70 73 | 20 68 65 72 65 2e 20 54 | pixMaps| here. T| |00001ee0| 68 65 20 62 61 73 65 41 | 64 64 72 20 66 69 65 6c |he baseA|ddr fiel| |00001ef0| 64 20 69 73 20 73 6b 69 | 70 70 65 64 20 77 68 65 |d is ski|pped whe| |00001f00| 6e 20 70 75 74 74 69 6e | 67 20 6f 75 74 20 69 6e |n puttin|g out in| |00001f10| 64 65 78 65 64 20 70 69 | 78 4d 61 70 73 20 61 6e |dexed pi|xMaps an| |00001f20| 64 20 69 73 20 73 65 74 | 20 74 6f 20 24 30 30 30 |d is set| to $000| |00001f30| 30 30 30 46 46 20 66 6f | 72 20 64 69 72 65 63 74 |000FF fo|r direct| |00001f40| 20 70 69 78 4d 61 70 73 | 2e 20 54 68 69 73 20 69 | pixMaps|. This i| |00001f50| 73 20 64 6f 6e 65 20 62 | 65 63 61 75 73 65 20 6d |s done b|ecause m| |00001f60| 61 63 68 69 6e 65 73 20 | 77 69 74 68 6f 75 74 20 |achines |without | |00001f70| 73 75 70 70 6f 72 74 20 | 66 6f 72 20 64 69 72 65 |support |for dire| |00001f80| 63 74 20 70 69 78 4d 61 | 70 73 20 28 6f 70 63 6f |ct pixMa|ps (opco| |00001f90| 64 65 20 24 39 41 29 20 | 72 65 61 64 20 61 20 77 |de $9A) |read a w| |00001fa0| 6f 72 64 20 66 72 6f 6d | 20 74 68 65 20 70 69 63 |ord from| the pic| |00001fb0| 74 75 72 65 2c 20 73 6b | 69 70 20 74 68 61 74 20 |ture, sk|ip that | |00001fc0| 6d 61 6e 79 20 62 79 74 | 65 73 2c 20 61 6e 64 20 |many byt|es, and | |00001fd0| 0d 63 6f 6e 74 69 6e 75 | 65 20 70 69 63 74 75 72 |.continu|e pictur| |00001fe0| 65 20 70 61 72 73 69 6e | 67 2e 20 57 68 65 6e 20 |e parsin|g. When | |00001ff0| 73 75 63 68 20 61 20 6d | 61 63 68 69 6e 65 20 65 |such a m|achine e| |00002000| 6e 63 6f 75 6e 74 65 72 | 73 20 74 68 65 20 24 30 |ncounter|s the $0| |00002010| 30 30 30 30 30 46 46 20 | 62 61 73 65 41 64 64 72 |00000FF |baseAddr| |00002020| 2c 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |, the nu|mber of | |00002030| 62 79 74 65 73 20 73 6b | 69 70 70 65 64 20 69 73 |bytes sk|ipped is| |00002040| 20 24 30 30 30 30 20 61 | 6e 64 20 74 68 65 20 6e | $0000 a|nd the n| |00002050| 65 78 74 20 6f 70 63 6f | 64 65 20 69 73 20 24 30 |ext opco|de is $0| |00002060| 30 46 46 2c 20 77 68 69 | 63 68 20 65 6e 64 73 20 |0FF, whi|ch ends | |00002070| 74 68 65 20 70 69 63 74 | 75 72 65 20 70 6c 61 79 |the pict|ure play| |00002080| 62 61 63 6b 2e 20 41 20 | 67 72 61 63 65 66 75 6c |back. A |graceful| |00002090| 20 65 78 69 74 20 66 72 | 6f 6d 20 61 20 74 6f 75 | exit fr|om a tou| |000020a0| 67 68 20 73 69 74 75 61 | 74 69 6f 6e 2e 0d 41 6e |gh situa|tion..An| |000020b0| 20 69 6e 74 65 72 65 73 | 74 69 6e 67 20 66 61 63 | interes|ting fac| |000020c0| 74 20 62 75 72 69 65 64 | 20 69 6e 20 74 68 65 20 |t buried| in the | |000020d0| 50 75 74 4f 75 74 50 69 | 78 4d 61 70 53 72 63 52 |PutOutPi|xMapSrcR| |000020e0| 65 63 74 44 73 74 52 65 | 63 74 41 6e 64 4d 6f 64 |ectDstRe|ctAndMod| |000020f0| 65 20 72 6f 75 74 69 6e | 65 20 69 73 20 74 68 65 |e routin|e is the| |00002100| 20 76 61 6c 75 65 20 6f | 66 20 70 61 63 6b 54 79 | value o|f packTy| |00002110| 70 65 2e 20 41 6c 6c 20 | 69 6e 2d 6d 65 6d 6f 72 |pe. All |in-memor| |00002120| 79 20 70 69 78 4d 61 70 | 73 20 28 74 68 61 74 20 |y pixMap|s (that | |00002130| 61 72 65 6e d5 74 20 69 | 6e 20 61 20 70 69 63 74 |aren.t i|n a pict| |00002140| 75 72 65 29 20 61 72 65 | 20 61 73 73 75 6d 65 64 |ure) are| assumed| |00002150| 20 74 6f 20 62 65 20 75 | 6e 70 61 63 6b 65 64 2e | to be u|npacked.| |00002160| 20 54 68 75 73 2c 20 79 | 6f 75 20 63 61 6e 20 73 | Thus, y|ou can s| |00002170| 65 74 20 74 68 65 20 70 | 61 63 6b 54 79 70 65 20 |et the p|ackType | |00002180| 66 69 65 6c 64 20 74 6f | 20 73 70 65 63 69 66 79 |field to| specify| |00002190| 20 74 68 65 20 74 79 70 | 65 20 6f 66 20 70 61 63 | the typ|e of pac| |000021a0| 6b 69 6e 67 20 74 68 65 | 20 70 69 78 4d 61 70 20 |king the| pixMap | |000021b0| 73 68 6f 75 6c 64 20 67 | 65 74 20 77 68 65 6e 20 |should g|et when | |000021c0| 70 75 74 20 69 6e 20 61 | 20 70 69 63 74 75 72 65 |put in a| picture| |000021d0| 2e 20 d2 54 68 65 20 4c | 6f 77 2d 44 6f 77 6e 20 |. .The L|ow-Down | |000021e0| 6f 6e 20 49 6d 61 67 65 | 20 43 6f 6d 70 72 65 73 |on Image| Compres| |000021f0| 73 69 6f 6e d3 20 28 64 | 65 76 65 6c 6f 70 20 49 |sion. (d|evelop I| |00002200| 73 73 75 65 20 36 2c 20 | 70 61 67 65 20 34 33 29 |ssue 6, |page 43)| |00002210| 20 67 69 76 65 73 20 64 | 65 74 61 69 6c 73 20 6f | gives d|etails o| |00002220| 66 20 74 68 65 20 64 69 | 66 66 65 72 65 6e 74 20 |f the di|fferent | |00002230| 70 69 78 4d 61 70 20 63 | 6f 6d 70 72 65 73 73 69 |pixMap c|ompressi| |00002240| 6f 6e 20 73 63 68 65 6d | 65 73 20 75 73 65 64 20 |on schem|es used | |00002250| 62 79 20 51 75 69 63 6b | 44 72 61 77 2e 20 4e 6f |by Quick|Draw. No| |00002260| 74 65 20 74 68 61 74 20 | 61 6c 6c 20 6f 66 20 51 |te that |all of Q| |00002270| 75 69 63 6b 44 72 61 77 | d5 73 20 65 78 69 73 74 |uickDraw|.s exist| |00002280| 69 6e 67 20 70 61 63 6b | 69 6e 67 20 73 63 68 65 |ing pack|ing sche| |00002290| 6d 65 73 20 6c 6f 73 65 | 20 6e 6f 20 69 6d 61 67 |mes lose| no imag| |000022a0| 65 20 71 75 61 6c 69 74 | 79 2e 20 51 75 69 63 6b |e qualit|y. Quick| |000022b0| 54 69 6d 65 20 28 74 68 | 65 20 6e 65 77 20 49 4e |Time (th|e new IN| |000022c0| 49 54 20 64 65 73 63 72 | 69 62 65 64 20 69 6e 20 |IT descr|ibed in | |000022d0| 64 65 74 61 69 6c 20 69 | 6e 20 74 68 65 20 6c 65 |detail i|n the le| |000022e0| 61 64 20 61 72 74 69 63 | 6c 65 20 69 6e 20 64 65 |ad artic|le in de| |000022f0| 76 65 6c 6f 70 20 49 73 | 73 75 65 20 37 29 20 61 |velop Is|sue 7) a| |00002300| 64 64 73 20 6d 61 6e 79 | 20 6e 65 77 20 70 61 63 |dds many| new pac| |00002310| 6b 69 6e 67 20 6d 65 74 | 68 6f 64 73 2c 20 6d 6f |king met|hods, mo| |00002320| 73 74 20 6f 66 20 77 68 | 69 63 68 20 73 61 63 72 |st of wh|ich sacr| |00002330| 69 66 69 63 65 20 73 6f | 6d 65 20 69 6d 61 67 65 |ifice so|me image| |00002340| 20 71 75 61 6c 69 74 79 | 20 74 6f 20 61 63 68 69 | quality| to achi| |00002350| 65 76 65 20 6d 75 63 68 | 20 68 69 67 68 65 72 20 |eve much| higher | |00002360| 63 6f 6d 70 72 65 73 73 | 69 6f 6e 2e 0d 41 6e 79 |compress|ion..Any| |00002370| 77 61 79 2c 20 74 68 65 | 73 65 20 72 6f 75 74 69 |way, the|se routi| |00002380| 6e 65 73 20 73 75 70 70 | 6f 72 74 20 6f 6e 6c 79 |nes supp|ort only| |00002390| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 70 61 63 | the def|ault pac| |000023a0| 6b 69 6e 67 20 66 6f 72 | 6d 61 74 73 3a 20 31 20 |king for|mats: 1 | |000023b0| 28 6f 72 20 75 6e 70 61 | 63 6b 65 64 29 20 66 6f |(or unpa|cked) fo| |000023c0| 72 20 61 6e 79 20 70 69 | 78 4d 61 70 20 77 69 74 |r any pi|xMap wit| |000023d0| 68 20 72 6f 77 42 79 74 | 65 73 20 6c 65 73 73 20 |h rowByt|es less | |000023e0| 74 68 61 6e 20 38 2c 20 | 30 20 66 6f 72 20 61 6c |than 8, |0 for al| |000023f0| 6c 20 6f 74 68 65 72 20 | 69 6e 64 65 78 65 64 20 |l other |indexed | |00002400| 70 69 78 4d 61 70 73 2c | 20 61 6e 64 20 34 20 66 |pixMaps,| and 4 f| |00002410| 6f 72 20 33 32 2d 62 69 | 74 20 64 69 72 65 63 74 |or 32-bi|t direct| |00002420| 20 70 69 78 4d 61 70 73 | 20 77 69 74 68 20 72 6f | pixMaps| with ro| |00002430| 77 42 79 74 65 73 20 67 | 72 65 61 74 65 72 20 74 |wBytes g|reater t| |00002440| 68 61 6e 20 38 2e 20 4e | 6f 74 65 20 74 68 61 74 |han 8. N|ote that| |00002450| 20 74 68 65 73 65 20 72 | 6f 75 74 69 6e 65 73 20 | these r|outines | |00002460| 64 6f 20 6e 6f 74 20 73 | 75 70 70 6f 72 74 20 31 |do not s|upport 1| |00002470| 36 2d 62 69 74 20 70 69 | 78 4d 61 70 73 2e 0d 46 |6-bit pi|xMaps..F| |00002480| 69 6e 61 6c 6c 79 2c 20 | 74 68 65 20 65 6e 64 2d |inally, |the end-| |00002490| 6f 66 2d 70 69 63 74 75 | 72 65 20 6f 70 63 6f 64 |of-pictu|re opcod| |000024a0| 65 20 69 73 20 70 75 74 | 20 6f 75 74 20 61 6e 64 |e is put| out and| |000024b0| 20 74 68 65 20 68 61 6e | 64 6c 65 20 69 73 20 72 | the han|dle is r| |000024c0| 65 73 69 7a 65 64 20 74 | 6f 20 74 68 65 20 61 6d |esized t|o the am| |000024d0| 6f 75 6e 74 20 61 63 74 | 75 61 6c 6c 79 20 75 73 |ount act|ually us| |000024e0| 65 64 2e 0d 50 69 63 48 | 61 6e 64 6c 65 20 43 72 |ed..PicH|andle Cr| |000024f0| 65 61 74 65 50 49 43 54 | 32 28 50 69 78 4d 61 70 |eatePICT|2(PixMap| |00002500| 20 2a 73 72 63 42 69 74 | 73 2c 20 52 65 63 74 20 | *srcBit|s, Rect | |00002510| 2a 73 72 63 52 65 63 74 | 2c 20 52 65 63 74 20 2a |*srcRect|, Rect *| |00002520| 64 73 74 52 65 63 74 2c | 20 0d 09 73 68 6f 72 74 |dstRect,| ..short| |00002530| 20 6d 6f 64 65 29 0d 7b | 0d 50 69 63 48 61 6e 64 | mode).{|.PicHand| |00002540| 6c 65 20 09 09 6d 79 50 | 69 63 3b 0d 73 68 6f 72 |le ..myP|ic;.shor| |00002550| 74 20 09 09 09 6d 79 52 | 6f 77 42 79 74 65 73 3b |t ...myR|owBytes;| |00002560| 0d 73 68 6f 72 74 20 09 | 09 09 2a 70 69 63 50 74 |.short .|..*picPt| |00002570| 72 3b 0d 73 68 6f 72 74 | 20 09 09 09 69 69 69 3b |r;.short| ...iii;| |00002580| 0d 6c 6f 6e 67 20 09 09 | 09 68 61 6e 64 6c 65 53 |.long ..|.handleS| |00002590| 69 7a 65 3b 0d 23 64 65 | 66 69 6e 65 20 43 4c 49 |ize;.#de|fine CLI| |000025a0| 50 53 49 5a 45 20 31 32 | 0d 23 64 65 66 69 6e 65 |PSIZE 12|.#define| |000025b0| 20 50 49 58 4d 41 50 52 | 45 43 53 49 5a 45 20 35 | PIXMAPR|ECSIZE 5| |000025c0| 30 0d 23 64 65 66 69 6e | 65 20 48 45 41 44 45 52 |0.#defin|e HEADER| |000025d0| 53 49 5a 45 20 34 30 0d | 23 64 65 66 69 6e 65 20 |SIZE 40.|#define | |000025e0| 4d 41 58 43 4f 4c 4f 52 | 54 41 42 4c 45 53 49 5a |MAXCOLOR|TABLESIZ| |000025f0| 45 20 32 35 36 2a 38 2b | 38 0d 23 64 65 66 69 6e |E 256*8+|8.#defin| |00002600| 65 20 4f 50 43 4f 44 45 | 4d 49 53 43 53 49 5a 45 |e OPCODE|MISCSIZE| |00002610| 20 32 2b 38 2b 38 2b 32 | 09 2f 2a 20 6f 70 63 6f | 2+8+8+2|./* opco| |00002620| 64 65 2b 73 72 63 52 65 | 63 74 2b 64 73 74 52 65 |de+srcRe|ct+dstRe| |00002630| 63 74 2b 6d 6f 64 65 20 | 2a 2f 0d 23 64 65 66 69 |ct+mode |*/.#defi| |00002640| 6e 65 20 45 4e 44 4f 46 | 50 49 43 54 53 49 5a 45 |ne ENDOF|PICTSIZE| |00002650| 20 32 0d 23 64 65 66 69 | 6e 65 20 50 49 43 53 49 | 2.#defi|ne PICSI| |00002660| 5a 45 20 50 49 58 4d 41 | 50 52 45 43 53 49 5a 45 |ZE PIXMA|PRECSIZE| |00002670| 20 2b 20 48 45 41 44 45 | 52 53 49 5a 45 20 2b 20 | + HEADE|RSIZE + | |00002680| 4d 41 58 43 4f 4c 4f 52 | 54 41 42 4c 45 53 49 5a |MAXCOLOR|TABLESIZ| |00002690| 45 20 2b 20 5c 0d 09 45 | 4e 44 4f 46 50 49 43 54 |E + \..E|NDOFPICT| |000026a0| 53 49 5a 45 20 2b 20 4f | 50 43 4f 44 45 4d 49 53 |SIZE + O|PCODEMIS| |000026b0| 43 53 49 5a 45 20 2b 20 | 43 4c 49 50 53 49 5a 45 |CSIZE + |CLIPSIZE| |000026c0| 0d 09 6d 79 52 6f 77 42 | 79 74 65 73 20 3d 20 73 |..myRowB|ytes = s| |000026d0| 72 63 42 69 74 73 2d 3e | 72 6f 77 42 79 74 65 73 |rcBits->|rowBytes| |000026e0| 20 26 20 30 78 33 66 66 | 66 3b 0d 2f 2a 20 41 6c | & 0x3ff|f;./* Al| |000026f0| 6c 6f 63 61 74 65 20 77 | 6f 72 73 74 2d 63 61 73 |locate w|orst-cas| |00002700| 65 20 6d 65 6d 6f 72 79 | 20 73 63 65 6e 61 72 69 |e memory| scenari| |00002710| 6f 20 75 73 69 6e 67 20 | 50 61 63 6b 42 69 74 73 |o using |PackBits| |00002720| 20 70 61 63 6b 69 6e 67 | 2e 20 2a 2f 0d 09 6d 79 | packing|. */..my| |00002730| 50 69 63 20 3d 20 28 50 | 69 63 48 61 6e 64 6c 65 |Pic = (P|icHandle| |00002740| 29 20 4e 65 77 48 61 6e | 64 6c 65 28 50 49 43 53 |) NewHan|dle(PICS| |00002750| 49 5a 45 20 2b 20 28 6c | 6f 6e 67 29 0d 09 09 28 |IZE + (l|ong)...(| |00002760| 28 6d 79 52 6f 77 42 79 | 74 65 73 2f 31 32 37 29 |(myRowBy|tes/127)| |00002770| 2b 32 2b 6d 79 52 6f 77 | 42 79 74 65 73 29 2a 28 |+2+myRow|Bytes)*(| |00002780| 6c 6f 6e 67 29 28 73 72 | 63 42 69 74 73 2d 3e 62 |long)(sr|cBits->b| |00002790| 6f 75 6e 64 73 2e 62 6f | 74 74 6f 6d 20 0d 09 09 |ounds.bo|ttom ...| |000027a0| 2d 20 73 72 63 42 69 74 | 73 2d 3e 62 6f 75 6e 64 |- srcBit|s->bound| |000027b0| 73 2e 74 6f 70 29 29 3b | 0d 0d 09 69 66 28 21 6d |s.top));|...if(!m| |000027c0| 79 50 69 63 29 0d 09 09 | 72 65 74 75 72 6e 28 30 |yPic)...|return(0| |000027d0| 29 3b 0d 2f 2a 20 53 6b | 69 70 20 70 69 63 53 69 |);./* Sk|ip picSi| |000027e0| 7a 65 20 61 6e 64 20 70 | 75 74 20 6f 75 74 20 70 |ze and p|ut out p| |000027f0| 69 63 46 72 61 6d 65 20 | 28 31 30 20 62 79 74 65 |icFrame |(10 byte| |00002800| 73 29 2e 20 2a 2f 0d 09 | 70 69 63 50 74 72 20 3d |s). */..|picPtr =| |00002810| 20 28 73 68 6f 72 74 20 | 2a 29 20 28 28 28 6c 6f | (short |*) (((lo| |00002820| 6e 67 29 2a 6d 79 50 69 | 63 29 20 2b 20 32 29 3b |ng)*myPi|c) + 2);| |00002830| 0d 09 2a 70 69 63 50 74 | 72 2b 2b 20 3d 20 64 73 |..*picPt|r++ = ds| |00002840| 74 52 65 63 74 2d 3e 74 | 6f 70 3b 0d 09 2a 70 69 |tRect->t|op;..*pi| |00002850| 63 50 74 72 2b 2b 20 3d | 20 64 73 74 52 65 63 74 |cPtr++ =| dstRect| |00002860| 2d 3e 6c 65 66 74 3b 0d | 09 2a 70 69 63 50 74 72 |->left;.|.*picPtr| |00002870| 2b 2b 20 3d 20 64 73 74 | 52 65 63 74 2d 3e 62 6f |++ = dst|Rect->bo| |00002880| 74 74 6f 6d 3b 0d 09 2a | 70 69 63 50 74 72 2b 2b |ttom;..*|picPtr++| |00002890| 20 3d 20 64 73 74 52 65 | 63 74 2d 3e 72 69 67 68 | = dstRe|ct->righ| |000028a0| 74 3b 0d 2f 2a 20 50 75 | 74 20 6f 75 74 20 68 65 |t;./* Pu|t out he| |000028b0| 61 64 65 72 20 28 33 30 | 20 62 79 74 65 73 29 2e |ader (30| bytes).| |000028c0| 20 54 68 69 73 20 63 6f | 75 6c 64 20 62 65 20 64 | This co|uld be d| |000028d0| 6f 6e 65 20 66 72 6f 6d | 20 61 20 72 65 73 6f 75 |one from| a resou| |000028e0| 72 63 65 20 6f 72 0d 09 | 74 61 6b 65 6e 20 66 72 |rce or..|taken fr| |000028f0| 6f 6d 20 61 6e 20 65 78 | 69 73 74 69 6e 67 20 70 |om an ex|isting p| |00002900| 69 63 74 75 72 65 2e 20 | 2a 2f 0d 09 2a 70 69 63 |icture. |*/..*pic| |00002910| 50 74 72 2b 2b 20 3d 20 | 30 78 31 31 3b 09 09 2f |Ptr++ = |0x11;../| |00002920| 2a 20 56 65 72 73 69 6f | 6e 20 6f 70 63 6f 64 65 |* Versio|n opcode| |00002930| 2e 20 2a 2f 0d 09 2a 70 | 69 63 50 74 72 2b 2b 20 |. */..*p|icPtr++ | |00002940| 3d 20 30 78 32 66 66 3b | 09 09 2f 2a 20 56 65 72 |= 0x2ff;|../* Ver| |00002950| 73 69 6f 6e 20 6e 75 6d | 62 65 72 2e 20 2a 2f 0d |sion num|ber. */.| |00002960| 09 2a 70 69 63 50 74 72 | 2b 2b 20 3d 20 30 78 43 |.*picPtr|++ = 0xC| |00002970| 30 30 3b 09 09 2f 2a 20 | 48 65 61 64 65 72 20 6f |00;../* |Header o| |00002980| 70 63 6f 64 65 2e 20 2a | 2f 0d 09 2a 70 69 63 50 |pcode. *|/..*picP| |00002990| 74 72 2b 2b 20 3d 20 30 | 78 46 46 46 46 3b 09 09 |tr++ = 0|xFFFF;..| |000029a0| 2f 2a 20 50 75 74 20 6f | 75 74 20 50 49 43 54 20 |/* Put o|ut PICT | |000029b0| 68 65 61 64 65 72 20 76 | 65 72 73 69 6f 6e 2e 20 |header v|ersion. | |000029c0| 2a 2f 0d 09 2a 70 69 63 | 50 74 72 2b 2b 20 3d 20 |*/..*pic|Ptr++ = | |000029d0| 30 78 46 46 46 46 3b 0d | 2f 2a 20 54 68 65 20 72 |0xFFFF;.|/* The r| |000029e0| 65 73 74 20 6f 66 20 74 | 68 65 20 68 65 61 64 65 |est of t|he heade| |000029f0| 72 20 69 73 20 69 67 6e | 6f 72 65 64 2d 2d 30 20 |r is ign|ored--0 | |00002a00| 69 74 20 6f 75 74 2e 20 | 2a 2f 0d 09 66 6f 72 28 |it out. |*/..for(| |00002a10| 69 69 69 20 3d 20 31 30 | 3b 20 69 69 69 20 3e 20 |iii = 10|; iii > | |00002a20| 30 3b 20 69 69 69 2d 2d | 29 0d 09 09 2a 70 69 63 |0; iii--|)...*pic| |00002a30| 50 74 72 2b 2b 20 3d 20 | 30 3b 09 09 2f 2a 20 57 |Ptr++ = |0;../* W| |00002a40| 72 69 74 65 20 6f 75 74 | 20 32 30 20 62 79 74 65 |rite out| 20 byte| |00002a50| 73 20 6f 66 20 30 2e 20 | 2a 2f 0d 2f 2a 20 50 75 |s of 0. |*/./* Pu| |00002a60| 74 20 6f 75 74 20 63 75 | 72 72 65 6e 74 20 70 6f |t out cu|rrent po| |00002a70| 72 74 27 73 20 63 6c 69 | 70 70 69 6e 67 20 72 65 |rt's cli|pping re| |00002a80| 67 69 6f 6e 2e 20 2a 2f | 0d 09 2a 70 69 63 50 74 |gion. */|..*picPt| |00002a90| 72 2b 2b 20 3d 20 30 78 | 30 31 3b 09 09 2f 2a 20 |r++ = 0x|01;../* | |00002aa0| 43 6c 69 70 70 69 6e 67 | 20 6f 70 63 6f 64 65 2e |Clipping| opcode.| |00002ab0| 20 2a 2f 0d 09 2a 70 69 | 63 50 74 72 2b 2b 20 3d | */..*pi|cPtr++ =| |00002ac0| 20 30 78 30 41 3b 09 09 | 2f 2a 20 43 6c 69 70 70 | 0x0A;..|/* Clipp| |00002ad0| 69 6e 67 20 72 65 67 69 | 6f 6e 20 6f 6e 6c 79 20 |ing regi|on only | |00002ae0| 68 61 73 20 62 6f 75 6e | 64 73 20 72 65 63 74 61 |has boun|ds recta| |00002af0| 6e 67 6c 65 2e 20 2a 2f | 0d 09 2a 70 69 63 50 74 |ngle. */|..*picPt| |00002b00| 72 2b 2b 20 3d 20 28 2a | 2a 74 68 65 50 6f 72 74 |r++ = (*|*thePort| |00002b10| 2d 3e 63 6c 69 70 52 67 | 6e 29 2e 72 67 6e 42 42 |->clipRg|n).rgnBB| |00002b20| 6f 78 2e 74 6f 70 3b 0d | 09 2a 70 69 63 50 74 72 |ox.top;.|.*picPtr| |00002b30| 2b 2b 20 3d 20 28 2a 2a | 74 68 65 50 6f 72 74 2d |++ = (**|thePort-| |00002b40| 3e 63 6c 69 70 52 67 6e | 29 2e 72 67 6e 42 42 6f |>clipRgn|).rgnBBo| |00002b50| 78 2e 6c 65 66 74 3b 0d | 09 2a 70 69 63 50 74 72 |x.left;.|.*picPtr| |00002b60| 2b 2b 20 3d 20 28 2a 2a | 74 68 65 50 6f 72 74 2d |++ = (**|thePort-| |00002b70| 3e 63 6c 69 70 52 67 6e | 29 2e 72 67 6e 42 42 6f |>clipRgn|).rgnBBo| |00002b80| 78 2e 62 6f 74 74 6f 6d | 3b 0d 09 2a 70 69 63 50 |x.bottom|;..*picP| |00002b90| 74 72 2b 2b 20 3d 20 28 | 2a 2a 74 68 65 50 6f 72 |tr++ = (|**thePor| |00002ba0| 74 2d 3e 63 6c 69 70 52 | 67 6e 29 2e 72 67 6e 42 |t->clipR|gn).rgnB| |00002bb0| 42 6f 78 2e 72 69 67 68 | 74 3b 0d 09 0d 09 48 4c |Box.righ|t;....HL| |00002bc0| 6f 63 6b 28 6d 79 50 69 | 63 29 3b 0d 09 69 66 28 |ock(myPi|c);..if(| |00002bd0| 73 72 63 42 69 74 73 2d | 3e 70 69 78 65 6c 54 79 |srcBits-|>pixelTy| |00002be0| 70 65 20 3d 3d 20 52 47 | 42 44 69 72 65 63 74 29 |pe == RG|BDirect)| |00002bf0| 0d 09 7b 09 09 09 2f 2a | 20 4d 75 73 74 20 62 65 |..{.../*| Must be| |00002c00| 20 33 32 2d 62 69 74 73 | 2f 70 69 78 65 6c 20 2a | 32-bits|/pixel *| |00002c10| 2f 0d 09 2f 2a 20 50 75 | 74 20 6f 75 74 20 6f 70 |/../* Pu|t out op| |00002c20| 63 6f 64 65 20 24 39 41 | 2c 20 44 69 72 65 63 74 |code $9A|, Direct| |00002c30| 42 69 74 73 52 65 63 74 | 2e 20 2a 2f 0d 09 09 2a |BitsRect|. */...*| |00002c40| 70 69 63 50 74 72 2b 2b | 20 3d 20 30 78 39 41 3b |picPtr++| = 0x9A;| |00002c50| 0d 09 09 2a 70 69 63 50 | 74 72 2b 2b 20 3d 20 30 |...*picP|tr++ = 0| |00002c60| 3b 09 2f 2a 20 42 61 73 | 65 41 64 64 72 20 66 6f |;./* Bas|eAddr fo| |00002c70| 72 20 64 69 72 65 63 74 | 20 70 69 78 4d 61 70 73 |r direct| pixMaps| |00002c80| 20 69 73 20 30 78 30 30 | 30 30 30 30 46 46 2e 20 | is 0x00|0000FF. | |00002c90| 2a 2f 0d 09 09 2a 70 69 | 63 50 74 72 2b 2b 20 3d |*/...*pi|cPtr++ =| |00002ca0| 20 30 78 46 46 3b 0d 09 | 09 50 75 74 4f 75 74 50 | 0xFF;..|.PutOutP| |00002cb0| 69 78 4d 61 70 53 72 63 | 52 65 63 74 44 73 74 52 |ixMapSrc|RectDstR| |00002cc0| 65 63 74 41 6e 64 4d 6f | 64 65 28 73 72 63 42 69 |ectAndMo|de(srcBi| |00002cd0| 74 73 2c 20 26 70 69 63 | 50 74 72 2c 20 73 72 63 |ts, &pic|Ptr, src| |00002ce0| 52 65 63 74 2c 20 0d 09 | 09 09 64 73 74 52 65 63 |Rect, ..|..dstRec| |00002cf0| 74 2c 20 6d 6f 64 65 29 | 3b 0d 09 09 69 66 28 50 |t, mode)|;...if(P| |00002d00| 75 74 4f 75 74 50 61 63 | 6b 65 64 44 69 72 65 63 |utOutPac|kedDirec| |00002d10| 74 50 69 78 44 61 74 61 | 28 73 72 63 42 69 74 73 |tPixData|(srcBits| |00002d20| 2c 20 26 70 69 63 50 74 | 72 29 29 0d 09 09 09 67 |, &picPt|r))....g| |00002d30| 6f 74 6f 20 65 72 72 6f | 72 45 78 69 74 3b 09 09 |oto erro|rExit;..| |00002d40| 2f 2a 20 4e 6f 6e 7a 65 | 72 6f 20 69 6e 64 69 63 |/* Nonze|ro indic| |00002d50| 61 74 65 73 20 61 6e 20 | 65 72 72 6f 72 2e 20 2a |ates an |error. *| |00002d60| 2f 0d 09 7d 0d 09 65 6c | 73 65 0d 09 7b 0d 09 2f |/..}..el|se..{../| |00002d70| 2a 20 50 75 74 20 6f 75 | 74 20 6f 70 63 6f 64 65 |* Put ou|t opcode| |00002d80| 20 24 39 38 2c 20 50 61 | 63 6b 42 69 74 73 52 65 | $98, Pa|ckBitsRe| |00002d90| 63 74 2e 20 2a 2f 0d 09 | 09 2a 70 69 63 50 74 72 |ct. */..|.*picPtr| |00002da0| 2b 2b 20 3d 20 30 78 39 | 38 3b 0d 0d 09 09 50 75 |++ = 0x9|8;....Pu| |00002db0| 74 4f 75 74 50 69 78 4d | 61 70 53 72 63 52 65 63 |tOutPixM|apSrcRec| |00002dc0| 74 44 73 74 52 65 63 74 | 41 6e 64 4d 6f 64 65 28 |tDstRect|AndMode(| |00002dd0| 73 72 63 42 69 74 73 2c | 20 26 70 69 63 50 74 72 |srcBits,| &picPtr| |00002de0| 2c 20 73 72 63 52 65 63 | 74 2c 0d 09 09 09 64 73 |, srcRec|t,....ds| |00002df0| 74 52 65 63 74 2c 20 6d | 6f 64 65 29 3b 0d 09 09 |tRect, m|ode);...| |00002e00| 69 66 28 50 75 74 4f 75 | 74 50 61 63 6b 65 64 49 |if(PutOu|tPackedI| |00002e10| 6e 64 65 78 65 64 50 69 | 78 44 61 74 61 28 73 72 |ndexedPi|xData(sr| |00002e20| 63 42 69 74 73 2c 20 26 | 70 69 63 50 74 72 29 29 |cBits, &|picPtr))| |00002e30| 0d 09 09 09 2f 2a 20 4e | 6f 6e 7a 65 72 6f 20 69 |..../* N|onzero i| |00002e40| 6e 64 69 63 61 74 65 73 | 20 61 6e 20 65 72 72 6f |ndicates| an erro| |00002e50| 72 2e 20 2a 2f 0d 09 09 | 09 67 6f 74 6f 20 65 72 |r. */...|.goto er| |00002e60| 72 6f 72 45 78 69 74 3b | 0d 09 09 09 09 09 09 09 |rorExit;|........| |00002e70| 0d 09 7d 0d 09 48 55 6e | 6c 6f 63 6b 28 6d 79 50 |..}..HUn|lock(myP| |00002e80| 69 63 29 3b 0d 09 0d 2f | 2a 20 41 6c 6c 20 64 6f |ic);.../|* All do| |00002e90| 6e 65 21 20 50 75 74 20 | 6f 75 74 20 65 6e 64 2d |ne! Put |out end-| |00002ea0| 6f 66 2d 70 69 63 74 75 | 72 65 20 6f 70 63 6f 64 |of-pictu|re opcod| |00002eb0| 65 2c 20 24 30 30 46 46 | 2e 20 2a 2f 0d 09 2a 70 |e, $00FF|. */..*p| |00002ec0| 69 63 50 74 72 2b 2b 20 | 3d 20 30 78 30 30 46 46 |icPtr++ |= 0x00FF| |00002ed0| 3b 0d 2f 2a 20 53 69 7a | 65 20 68 61 6e 64 6c 65 |;./* Siz|e handle| |00002ee0| 20 64 6f 77 6e 20 74 6f | 20 74 68 65 20 61 6d 6f | down to| the amo| |00002ef0| 75 6e 74 20 61 63 74 75 | 61 6c 6c 79 20 75 73 65 |unt actu|ally use| |00002f00| 64 2e 20 2a 2f 0d 09 68 | 61 6e 64 6c 65 53 69 7a |d. */..h|andleSiz| |00002f10| 65 20 3d 20 28 6c 6f 6e | 67 29 20 70 69 63 50 74 |e = (lon|g) picPt| |00002f20| 72 20 2d 20 28 6c 6f 6e | 67 29 20 2a 6d 79 50 69 |r - (lon|g) *myPi| |00002f30| 63 3b 0d 09 53 65 74 48 | 61 6e 64 6c 65 53 69 7a |c;..SetH|andleSiz| |00002f40| 65 28 6d 79 50 69 63 2c | 20 68 61 6e 64 6c 65 53 |e(myPic,| handleS| |00002f50| 69 7a 65 29 3b 0d 09 2f | 2a 20 57 72 69 74 65 20 |ize);../|* Write | |00002f60| 6f 75 74 20 70 69 63 74 | 75 72 65 20 73 69 7a 65 |out pict|ure size| |00002f70| 2e 20 2a 2f 0d 09 2a 28 | 28 73 68 6f 72 74 20 2a |. */..*(|(short *| |00002f80| 29 20 2a 6d 79 50 69 63 | 29 20 3d 20 28 73 68 6f |) *myPic|) = (sho| |00002f90| 72 74 29 20 68 61 6e 64 | 6c 65 53 69 7a 65 3b 0d |rt) hand|leSize;.| |00002fa0| 09 72 65 74 75 72 6e 28 | 6d 79 50 69 63 29 3b 0d |.return(|myPic);.| |00002fb0| 65 72 72 6f 72 45 78 69 | 74 3a 0d 09 44 69 73 70 |errorExi|t:..Disp| |00002fc0| 6f 73 48 61 6e 64 6c 65 | 28 6d 79 50 69 63 29 3b |osHandle|(myPic);| |00002fd0| 0d 09 72 65 74 75 72 6e | 28 30 29 3b 0d 7d 0d 4a |..return|(0);.}.J| |00002fe0| 75 73 74 20 72 65 6d 65 | 6d 62 65 72 20 74 68 61 |ust reme|mber tha| |00002ff0| 74 20 69 74 d5 73 20 6e | 6f 74 20 61 64 76 69 73 |t it.s n|ot advis| |00003000| 61 62 6c 65 20 74 6f 20 | 70 61 73 73 20 61 20 70 |able to |pass a p| |00003010| 69 78 4d 61 70 20 79 6f | 75 20 63 72 65 61 74 65 |ixMap yo|u create| |00003020| 20 79 6f 75 72 73 65 6c | 66 20 74 6f 20 61 20 74 | yoursel|f to a t| |00003030| 72 61 70 2e 20 54 68 65 | 20 72 65 61 73 6f 6e 20 |rap. The| reason | |00003040| 69 73 20 74 68 61 74 20 | 61 6c 74 68 6f 75 67 68 |is that |although| |00003050| 20 69 74 d5 73 20 75 6e | 6c 69 6b 65 6c 79 2c 20 | it.s un|likely, | |00003060| 74 68 65 20 66 6f 72 6d | 61 74 20 6f 66 20 61 20 |the form|at of a | |00003070| 70 69 78 4d 61 70 20 63 | 6f 75 6c 64 20 63 68 61 |pixMap c|ould cha| |00003080| 6e 67 65 20 28 73 69 6e | 63 65 20 69 74 d5 73 20 |nge (sin|ce it.s | |00003090| 6e 6f 74 20 61 20 70 65 | 72 73 69 73 74 65 6e 74 |not a pe|rsistent| |000030a0| 20 64 61 74 61 20 73 74 | 72 75 63 74 75 72 65 2c | data st|ructure,| |000030b0| 20 61 73 20 61 20 70 69 | 63 74 75 72 65 20 69 73 | as a pi|cture is| |000030c0| 29 3b 20 74 68 69 73 20 | 77 6f 75 6c 64 20 74 68 |); this |would th| |000030d0| 65 6e 20 62 72 65 61 6b | 20 79 6f 75 72 20 61 70 |en break| your ap| |000030e0| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 54 68 65 20 73 |plicatio|n..The s| |000030f0| 75 62 72 6f 75 74 69 6e | 65 73 20 74 68 65 20 43 |ubroutin|es the C| |00003100| 72 65 61 74 65 50 49 43 | 54 32 20 72 6f 75 74 69 |reatePIC|T2 routi| |00003110| 6e 65 20 63 61 6c 6c 73 | 20 61 73 20 77 65 6c 6c |ne calls| as well| |00003120| 20 61 73 20 73 6f 6d 65 | 20 73 61 6d 70 6c 65 20 | as some| sample | |00003130| 63 6f 64 65 20 74 68 61 | 74 20 75 73 65 73 20 43 |code tha|t uses C| |00003140| 72 65 61 74 65 50 49 43 | 54 32 20 61 72 65 20 6f |reatePIC|T2 are o| |00003150| 6e 20 74 68 65 20 44 65 | 76 65 6c 6f 70 65 72 20 |n the De|veloper | |00003160| 43 44 20 53 65 72 69 65 | 73 20 64 69 73 63 2e 0d |CD Serie|s disc..| |00003170| 50 52 4f 43 45 53 53 49 | 4e 47 20 43 4f 4c 4f 52 |PROCESSI|NG COLOR| |00003180| 20 49 4d 41 47 45 53 20 | 46 4f 52 20 44 49 53 50 | IMAGES |FOR DISP| |00003190| 4c 41 59 0d 54 68 65 20 | 72 65 6d 61 69 6e 64 65 |LAY.The |remainde| |000031a0| 72 20 6f 66 20 74 68 69 | 73 20 61 72 74 69 63 6c |r of thi|s articl| |000031b0| 65 20 66 6f 63 75 73 65 | 73 20 6f 6e 20 70 72 6f |e focuse|s on pro| |000031c0| 63 65 73 73 69 6e 67 20 | 63 6f 6c 6f 72 20 69 6d |cessing |color im| |000031d0| 61 67 65 73 20 66 6f 72 | 20 64 69 73 70 6c 61 79 |ages for| display| |000031e0| 20 6f 6e 20 31 2d 62 69 | 74 20 28 62 6c 61 63 6b | on 1-bi|t (black| |000031f0| 2d 61 6e 64 2d 77 68 69 | 74 65 29 20 64 65 76 69 |-and-whi|te) devi| |00003200| 63 65 73 2c 20 62 6f 74 | 68 20 6d 6f 6e 69 74 6f |ces, bot|h monito| |00003210| 72 73 20 61 6e 64 20 6c | 61 73 65 72 20 70 72 69 |rs and l|aser pri| |00003220| 6e 74 65 72 73 2e 0d 54 | 68 65 72 65 20 61 72 65 |nters..T|here are| |00003230| 20 6d 61 6e 79 20 74 65 | 63 68 6e 69 71 75 65 73 | many te|chniques| |00003240| 20 66 6f 72 20 72 65 70 | 72 65 73 65 6e 74 69 6e | for rep|resentin| |00003250| 67 20 61 20 66 75 6c 6c | 2d 63 6f 6c 6f 72 20 69 |g a full|-color i| |00003260| 6d 61 67 65 20 6f 6e 20 | 61 20 6d 6f 6e 69 74 6f |mage on |a monito| |00003270| 72 20 77 68 65 6e 20 63 | 6f 6c 6f 72 20 72 65 73 |r when c|olor res| |00003280| 6f 75 72 63 65 73 20 61 | 72 65 20 6c 69 6d 69 74 |ources a|re limit| |00003290| 65 64 2e 20 54 68 65 20 | 50 69 63 74 75 72 65 20 |ed. The |Picture | |000032a0| 55 74 69 6c 69 74 69 65 | 73 20 50 61 63 6b 61 67 |Utilitie|s Packag| |000032b0| 65 20 28 6e 65 77 20 69 | 6e 20 53 79 73 74 65 6d |e (new i|n System| |000032c0| 20 37 29 20 6f 66 66 65 | 72 73 20 72 6f 75 74 69 | 7) offe|rs routi| |000032d0| 6e 65 73 20 66 6f 72 20 | 64 65 74 65 72 6d 69 6e |nes for |determin| |000032e0| 69 6e 67 20 6f 70 74 69 | 6d 61 6c 20 63 6f 6c 6f |ing opti|mal colo| |000032f0| 72 73 20 74 6f 20 75 73 | 65 20 77 68 65 6e 20 64 |rs to us|e when d| |00003300| 69 73 70 6c 61 79 69 6e | 67 20 61 20 70 69 78 4d |isplayin|g a pixM| |00003310| 61 70 20 69 6e 20 61 20 | 6c 69 6d 69 74 65 64 20 |ap in a |limited | |00003320| 63 6f 6c 6f 72 20 73 70 | 61 63 65 2e 20 46 6f 72 |color sp|ace. For| |00003330| 20 65 78 61 6d 70 6c 65 | 2c 20 69 66 20 79 6f 75 | example|, if you| |00003340| 20 77 61 6e 74 20 74 6f | 20 64 69 73 70 6c 61 79 | want to| display| |00003350| 20 61 20 33 32 2d 62 69 | 74 20 69 6d 61 67 65 20 | a 32-bi|t image | |00003360| 6f 6e 20 61 6e 20 38 2d | 62 69 74 20 6d 6f 6e 69 |on an 8-|bit moni| |00003370| 74 6f 72 2c 20 50 69 63 | 74 75 72 65 20 55 74 69 |tor, Pic|ture Uti| |00003380| 6c 69 74 69 65 73 20 63 | 61 6e 20 74 65 6c 6c 20 |lities c|an tell | |00003390| 79 6f 75 20 74 68 65 20 | 32 35 36 20 62 65 73 74 |you the |256 best| |000033a0| 20 63 6f 6c 6f 72 73 20 | 74 6f 20 75 73 65 20 74 | colors |to use t| |000033b0| 6f 20 64 69 73 70 6c 61 | 79 20 74 68 65 20 69 6d |o displa|y the im| |000033c0| 61 67 65 2e 20 54 68 65 | 20 43 72 65 61 74 65 50 |age. The| CreateP| |000033d0| 49 43 54 32 20 72 6f 75 | 74 69 6e 65 20 6a 75 73 |ICT2 rou|tine jus| |000033e0| 74 20 64 65 73 63 72 69 | 62 65 64 20 63 72 65 61 |t descri|bed crea| |000033f0| 74 65 73 20 61 20 70 69 | 63 74 75 72 65 20 74 68 |tes a pi|cture th| |00003400| 61 74 20 79 6f 75 20 63 | 61 6e 20 6c 65 67 61 6c |at you c|an legal| |00003410| 6c 79 20 61 6e 61 6c 79 | 7a 65 20 75 73 69 6e 67 |ly analy|ze using| |00003420| 20 74 68 65 20 50 69 63 | 74 75 72 65 20 55 74 69 | the Pic|ture Uti| |00003430| 6c 69 74 69 65 73 2e 0d | 59 6f 75 20 63 61 6e 20 |lities..|You can | |00003440| 61 6c 73 6f 20 75 73 65 | 20 74 68 65 20 74 65 63 |also use| the tec| |00003450| 68 6e 69 71 75 65 73 20 | 6f 66 20 74 68 72 65 73 |hniques |of thres| |00003460| 68 6f 6c 64 69 6e 67 20 | 61 6e 64 20 6f 66 20 64 |holding |and of d| |00003470| 69 74 68 65 72 69 6e 67 | 2c 20 6f 66 20 77 68 69 |ithering|, of whi| |00003480| 63 68 20 74 68 65 72 65 | 20 61 72 65 20 74 68 72 |ch there| are thr| |00003490| 65 65 20 76 61 72 69 65 | 74 69 65 73 3a 20 65 72 |ee varie|ties: er| |000034a0| 72 6f 72 20 64 69 66 66 | 75 73 69 6f 6e 2c 20 6f |ror diff|usion, o| |000034b0| 72 64 65 72 65 64 2c 20 | 61 6e 64 20 72 61 6e 64 |rdered, |and rand| |000034c0| 6f 6d 2e 20 4f 72 64 65 | 72 65 64 20 64 69 74 68 |om. Orde|red dith| |000034d0| 65 72 69 6e 67 2c 20 61 | 6c 73 6f 20 6b 6e 6f 77 |ering, a|lso know| |000034e0| 6e 20 61 73 20 68 61 6c | 66 74 6f 6e 69 6e 67 2c |n as hal|ftoning,| |000034f0| 20 69 73 20 70 61 72 74 | 69 63 75 6c 61 72 6c 79 | is part|icularly| |00003500| 20 75 73 65 66 75 6c 20 | 66 6f 72 20 70 72 6f 64 | useful |for prod| |00003510| 75 63 69 6e 67 20 69 6d | 61 67 65 73 20 74 6f 20 |ucing im|ages to | |00003520| 62 65 20 70 72 69 6e 74 | 65 64 20 6f 6e 20 61 20 |be print|ed on a | |00003530| 6c 61 73 65 72 20 70 72 | 69 6e 74 65 72 2e 20 57 |laser pr|inter. W| |00003540| 65 d5 6c 6c 20 65 78 61 | 6d 69 6e 65 20 65 61 63 |e.ll exa|mine eac| |00003550| 68 20 6f 66 20 74 68 65 | 73 65 20 74 65 63 68 6e |h of the|se techn| |00003560| 69 71 75 65 73 20 69 6e | 20 74 75 72 6e 2e 20 0d |iques in| turn. .| |00003570| 55 53 49 4e 47 20 41 20 | 35 30 25 20 54 48 52 45 |USING A |50% THRE| |00003580| 53 48 4f 4c 44 0d 54 68 | 65 20 66 69 72 73 74 20 |SHOLD.Th|e first | |00003590| 74 65 63 68 6e 69 71 75 | 65 20 74 68 61 74 20 6c |techniqu|e that l| |000035a0| 65 61 70 73 20 74 6f 20 | 6d 69 6e 64 20 77 68 65 |eaps to |mind whe| |000035b0| 6e 20 6f 6e 65 20 69 73 | 20 66 61 63 65 64 20 77 |n one is| faced w| |000035c0| 69 74 68 20 64 69 73 70 | 6c 61 79 69 6e 67 20 61 |ith disp|laying a| |000035d0| 20 63 6f 6c 6f 72 20 70 | 69 63 74 75 72 65 20 6f | color p|icture o| |000035e0| 6e 20 61 20 31 2d 62 69 | 74 20 73 63 72 65 65 6e |n a 1-bi|t screen| |000035f0| 20 69 73 20 74 6f 20 63 | 6f 6e 76 65 72 74 20 65 | is to c|onvert e| |00003600| 61 63 68 20 63 6f 6c 6f | 72 20 74 6f 20 61 20 6c |ach colo|r to a l| |00003610| 75 6d 69 6e 61 6e 63 65 | 20 61 6e 64 20 74 68 65 |uminance| and the| |00003620| 6e 20 75 73 65 20 61 20 | 74 68 72 65 73 68 6f 6c |n use a |threshol| |00003630| 64 20 76 61 6c 75 65 20 | 74 6f 20 64 65 74 65 72 |d value |to deter| |00003640| 6d 69 6e 65 20 77 68 65 | 74 68 65 72 20 6f 72 20 |mine whe|ther or | |00003650| 6e 6f 74 20 74 6f 20 73 | 65 74 20 74 68 65 20 63 |not to s|et the c| |00003660| 6f 72 72 65 73 70 6f 6e | 64 69 6e 67 20 70 69 78 |orrespon|ding pix| |00003670| 65 6c 2e 20 49 74 20 74 | 75 72 6e 73 20 6f 75 74 |el. It t|urns out| |00003680| 20 74 68 61 74 20 67 72 | 65 65 6e 20 63 6f 6e 74 | that gr|een cont| |00003690| 72 69 62 75 74 65 73 20 | 74 68 65 20 6d 6f 73 74 |ributes |the most| |000036a0| 20 74 6f 20 74 68 65 20 | 6c 75 6d 69 6e 61 6e 63 | to the |luminanc| |000036b0| 65 20 61 6e 64 20 62 6c | 75 65 20 63 6f 6e 74 72 |e and bl|ue contr| |000036c0| 69 62 75 74 65 73 20 74 | 68 65 20 6c 65 61 73 74 |ibutes t|he least| |000036d0| 2e 20 52 65 64 2c 20 67 | 72 65 65 6e 2c 20 61 6e |. Red, g|reen, an| |000036e0| 64 20 62 6c 75 65 20 63 | 6f 6e 74 72 69 62 75 74 |d blue c|ontribut| |000036f0| 65 20 61 70 70 72 6f 78 | 69 6d 61 74 65 6c 79 20 |e approx|imately | |00003700| 33 30 25 2c 20 35 39 25 | 2c 20 61 6e 64 20 31 31 |30%, 59%|, and 11| |00003710| 25 2c 20 72 65 73 70 65 | 63 74 69 76 65 6c 79 2c |%, respe|ctively,| |00003720| 20 74 6f 20 74 68 65 20 | 6c 75 6d 69 6e 61 6e 63 | to the |luminanc| |00003730| 65 2e 20 54 68 75 73 2c | 20 6f 75 72 20 66 6f 72 |e. Thus,| our for| |00003740| 6d 75 6c 61 20 74 6f 20 | 63 6f 6e 76 65 72 74 20 |mula to |convert | |00003750| 61 6e 20 52 47 42 20 76 | 61 6c 75 65 20 74 6f 20 |an RGB v|alue to | |00003760| 61 20 6c 75 6d 69 6e 61 | 6e 63 65 20 62 65 63 6f |a lumina|nce beco| |00003770| 6d 65 73 0d 4c 75 6d 69 | 6e 61 6e 63 65 20 3d 20 |mes.Lumi|nance = | |00003780| 28 33 30 2a 52 45 44 20 | 2b 20 35 39 2a 47 52 45 |(30*RED |+ 59*GRE| |00003790| 45 4e 20 2b 20 31 31 2a | 42 4c 55 45 29 2f 31 30 |EN + 11*|BLUE)/10| |000037a0| 30 0d 49 66 20 74 68 65 | 20 72 65 73 75 6c 74 69 |0.If the| resulti| |000037b0| 6e 67 20 6c 75 6d 69 6e | 61 6e 63 65 20 69 73 20 |ng lumin|ance is | |000037c0| 31 32 38 20 28 35 30 25 | 20 6f 66 20 32 35 36 29 |128 (50%| of 256)| |000037d0| 20 6f 72 20 67 72 65 61 | 74 65 72 2c 20 74 68 65 | or grea|ter, the| |000037e0| 20 70 69 78 65 6c 20 69 | 73 20 73 65 74 20 74 6f | pixel i|s set to| |000037f0| 20 77 68 69 74 65 3b 20 | 6f 74 68 65 72 77 69 73 | white; |otherwis| |00003800| 65 20 69 74 d5 73 20 73 | 65 74 20 74 6f 20 62 6c |e it.s s|et to bl| |00003810| 61 63 6b 2e 20 54 68 69 | 73 20 74 65 63 68 6e 69 |ack. Thi|s techni| |00003820| 71 75 65 20 70 72 6f 64 | 75 63 65 73 20 74 68 65 |que prod|uces the| |00003830| 20 72 65 73 75 6c 74 73 | 20 73 68 6f 77 6e 20 69 | results| shown i| |00003840| 6e 20 46 69 67 75 72 65 | 20 31 20 66 6f 72 20 67 |n Figure| 1 for g| |00003850| 72 61 79 20 67 72 61 64 | 61 74 69 6f 6e 73 20 61 |ray grad|ations a| |00003860| 6e 64 20 61 20 6c 6f 76 | 65 6c 79 20 70 69 63 74 |nd a lov|ely pict| |00003870| 75 72 65 20 6f 66 20 6f | 6e 65 20 6f 66 20 74 68 |ure of o|ne of th| |00003880| 65 20 61 75 74 68 6f 72 | 73 2e 20 4e 6f 74 65 20 |e author|s. Note | |00003890| 74 68 61 74 20 74 68 72 | 65 73 68 6f 6c 64 69 6e |that thr|esholdin| |000038a0| 67 20 6f 63 63 75 72 73 | 20 61 74 20 74 68 65 20 |g occurs| at the | |000038b0| 73 6f 75 72 63 65 20 70 | 69 78 65 6c 20 72 65 73 |source p|ixel res| |000038c0| 6f 6c 75 74 69 6f 6e 2e | 20 54 68 75 73 2c 20 65 |olution.| Thus, e| |000038d0| 76 65 6e 20 74 68 6f 75 | 67 68 20 74 68 65 20 6f |ven thou|gh the o| |000038e0| 75 74 70 75 74 20 64 65 | 76 69 63 65 20 75 73 65 |utput de|vice use| |000038f0| 64 20 74 6f 20 70 72 6f | 64 75 63 65 20 4b 6f 6e |d to pro|duce Kon| |00003900| 65 6e 6e 61 20 69 73 20 | 33 30 30 20 64 70 69 2c |enna is |300 dpi,| |00003910| 20 74 68 65 20 74 68 72 | 65 73 68 6f 6c 64 65 64 | the thr|esholded| |00003920| 20 70 69 63 74 75 72 65 | 20 61 70 70 65 61 72 73 | picture| appears| |00003930| 20 74 6f 20 62 65 20 37 | 32 20 64 70 69 2e 20 49 | to be 7|2 dpi. I| |00003940| 6e 20 63 6f 6e 74 72 61 | 73 74 2c 20 74 68 65 20 |n contra|st, the | |00003950| 74 65 63 68 6e 69 71 75 | 65 73 20 6f 66 20 65 72 |techniqu|es of er| |00003960| 72 6f 72 2d 64 69 66 66 | 75 73 69 6f 6e 20 64 69 |ror-diff|usion di| |00003970| 74 68 65 72 69 6e 67 20 | 61 6e 64 20 68 61 6c 66 |thering |and half| |00003980| 74 6f 6e 69 6e 67 20 64 | 69 73 63 75 73 73 65 64 |toning d|iscussed| |00003990| 20 6f 6e 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e | on the |followin| |000039a0| 67 20 70 61 67 65 73 20 | 6f 63 63 75 72 20 61 74 |g pages |occur at| |000039b0| 20 74 68 65 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | the des|tination| |000039c0| 20 64 65 76 69 63 65 20 | 72 65 73 6f 6c 75 74 69 | device |resoluti| |000039d0| 6f 6e 2e 0d 54 68 65 20 | 72 65 73 75 6c 74 73 20 |on..The |results | |000039e0| 73 68 6f 77 6e 20 69 6e | 20 46 69 67 75 72 65 20 |shown in| Figure | |000039f0| 31 20 61 72 65 20 66 61 | 72 20 66 72 6f 6d 20 69 |1 are fa|r from i| |00003a00| 64 65 61 6c 2e 20 54 68 | 65 20 67 72 61 79 20 67 |deal. Th|e gray g| |00003a10| 72 61 64 61 74 69 6f 6e | 73 20 65 6e 64 20 75 70 |radation|s end up| |00003a20| 20 61 73 20 61 20 62 6c | 61 63 6b 20 72 65 63 74 | as a bl|ack rect| |00003a30| 61 6e 67 6c 65 20 62 65 | 73 69 64 65 20 61 20 77 |angle be|side a w| |00003a40| 68 69 74 65 20 72 65 63 | 74 61 6e 67 6c 65 2c 20 |hite rec|tangle, | |00003a50| 61 6e 64 20 74 68 65 20 | 70 69 63 74 75 72 65 20 |and the |picture | |00003a60| 6f 66 20 4b 6f 6e 65 6e | 6e 61 2c 20 77 68 69 6c |of Konen|na, whil| |00003a70| 65 20 73 74 69 6c 6c 20 | 63 75 74 65 2c 20 69 73 |e still |cute, is| |00003a80| 20 63 6f 6d 70 6c 65 74 | 65 6c 79 20 64 65 76 6f | complet|ely devo| |00003a90| 69 64 20 6f 66 20 64 65 | 74 61 69 6c 2e 0d 55 53 |id of de|tail..US| |00003aa0| 49 4e 47 20 45 52 52 4f | 52 2d 44 49 46 46 55 53 |ING ERRO|R-DIFFUS| |00003ab0| 49 4f 4e 20 44 49 54 48 | 45 52 49 4e 47 0d 54 68 |ION DITH|ERING.Th| |00003ac0| 65 20 6d 61 6a 6f 72 20 | 70 72 6f 62 6c 65 6d 20 |e major |problem | |00003ad0| 77 69 74 68 20 74 68 65 | 20 74 68 72 65 73 68 6f |with the| thresho| |00003ae0| 6c 64 20 61 6c 67 6f 72 | 69 74 68 6d 20 69 73 20 |ld algor|ithm is | |00003af0| 74 68 61 74 20 61 20 67 | 72 65 61 74 20 64 65 61 |that a g|reat dea| |00003b00| 6c 20 6f 66 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |l of inf|ormation| |00003b10| 20 69 73 20 74 68 72 6f | 77 6e 20 61 77 61 79 2e | is thro|wn away.| |00003b20| 20 54 68 65 20 6c 75 6d | 69 6e 61 6e 63 65 20 69 | The lum|inance i| |00003b30| 73 20 63 61 6c 63 75 6c | 61 74 65 64 20 61 73 20 |s calcul|ated as | |00003b40| 61 20 76 61 6c 75 65 20 | 62 65 74 77 65 65 6e 20 |a value |between | |00003b50| 30 20 61 6e 64 20 32 35 | 35 2c 20 62 75 74 20 74 |0 and 25|5, but t| |00003b60| 68 65 20 6f 6e 6c 79 20 | 69 6e 66 6f 72 6d 61 74 |he only |informat| |00003b70| 69 6f 6e 20 77 65 20 75 | 73 65 20 69 73 20 77 68 |ion we u|se is wh| |00003b80| 65 74 68 65 72 20 69 74 | d5 73 20 31 32 38 20 6f |ether it|.s 128 o| |00003b90| 72 20 67 72 65 61 74 65 | 72 2e 0d 41 6e 20 65 61 |r greate|r..An ea| |00003ba0| 73 79 20 66 69 78 20 69 | 73 20 74 6f 20 70 72 65 |sy fix i|s to pre| |00003bb0| 73 65 72 76 65 20 74 68 | 65 20 6f 76 65 72 61 6c |serve th|e overal| |00003bc0| 6c 20 69 6d 61 67 65 20 | 6c 69 67 68 74 6e 65 73 |l image |lightnes| |00003bd0| 73 20 62 79 20 6d 61 69 | 6e 74 61 69 6e 69 6e 67 |s by mai|ntaining| |00003be0| 20 61 6e 20 65 72 72 6f | 72 20 74 65 72 6d 20 61 | an erro|r term a| |00003bf0| 6e 64 20 74 68 65 6e 20 | 70 61 73 73 69 6e 67 20 |nd then |passing | |00003c00| 74 68 65 20 65 72 72 6f | 72 20 6f 6e 74 6f 20 6e |the erro|r onto n| |00003c10| 65 69 67 68 62 6f 72 69 | 6e 67 20 70 69 78 65 6c |eighbori|ng pixel| |00003c20| 73 2e 20 42 6f 74 68 20 | 6f 72 69 67 69 6e 61 6c |s. Both |original| |00003c30| 20 61 6e 64 20 43 6f 6c | 6f 72 20 51 75 69 63 6b | and Col|or Quick| |00003c40| 44 72 61 77 20 68 61 76 | 65 20 64 69 74 68 65 72 |Draw hav|e dither| |00003c50| 69 6e 67 20 61 6c 67 6f | 72 69 74 68 6d 73 20 62 |ing algo|rithms b| |00003c60| 75 69 6c 74 20 69 6e 20 | 66 6f 72 20 70 72 65 63 |uilt in |for prec| |00003c70| 69 73 65 6c 79 20 74 68 | 69 73 20 70 75 72 70 6f |isely th|is purpo| |00003c80| 73 65 2e 20 28 59 65 73 | 2c 20 69 74 d5 73 20 74 |se. (Yes|, it.s t| |00003c90| 72 75 65 d1 77 68 69 6c | 65 20 61 20 64 69 74 68 |rue.whil|e a dith| |00003ca0| 65 72 20 66 6c 61 67 20 | 63 61 6e 6e 6f 74 20 62 |er flag |cannot b| |00003cb0| 65 20 70 61 73 73 65 64 | 20 65 78 70 6c 69 63 69 |e passed| explici| |00003cc0| 74 6c 79 20 74 6f 20 61 | 6e 79 20 6f 72 69 67 69 |tly to a|ny origi| |00003cd0| 6e 61 6c 20 51 75 69 63 | 6b 44 72 61 77 20 74 72 |nal Quic|kDraw tr| |00003ce0| 61 70 2c 20 61 20 70 69 | 63 74 75 72 65 20 63 6f |ap, a pi|cture co| |00003cf0| 6e 74 61 69 6e 69 6e 67 | 20 61 20 63 6f 6c 6f 72 |ntaining| a color| |00003d00| 20 62 69 74 20 69 6d 61 | 67 65 20 63 72 65 61 74 | bit ima|ge creat| |00003d10| 65 64 20 75 73 69 6e 67 | 20 64 69 74 68 65 72 20 |ed using| dither | |00003d20| 6d 6f 64 65 20 6f 6e 20 | 61 20 43 6f 6c 6f 72 20 |mode on |a Color | |00003d30| 51 75 69 63 6b 44 72 61 | 77 20 6d 61 63 68 69 6e |QuickDra|w machin| |00003d40| 65 20 77 69 6c 6c 20 64 | 69 74 68 65 72 20 77 68 |e will d|ither wh| |00003d50| 65 6e 20 64 72 61 77 6e | 20 77 69 74 68 20 6f 72 |en drawn| with or| |00003d60| 69 67 69 6e 61 6c 20 51 | 75 69 63 6b 44 72 61 77 |iginal Q|uickDraw| |00003d70| 2e 29 20 54 68 65 20 65 | 72 72 6f 72 20 69 73 20 |.) The e|rror is | |00003d80| 63 61 6c 63 75 6c 61 74 | 65 64 20 61 73 0d 45 72 |calculat|ed as.Er| |00003d90| 72 6f 72 20 3d 20 52 65 | 71 75 65 73 74 65 64 20 |ror = Re|quested | |00003da0| 49 6e 74 65 6e 73 69 74 | 79 20 2d 20 43 6c 6f 73 |Intensit|y - Clos| |00003db0| 65 73 74 20 41 76 61 69 | 6c 61 62 6c 65 20 49 6e |est Avai|lable In| |00003dc0| 74 65 6e 73 69 74 79 0d | 46 6f 72 20 61 20 62 6c |tensity.|For a bl| |00003dd0| 61 63 6b 2d 61 6e 64 2d | 77 68 69 74 65 20 64 65 |ack-and-|white de| |00003de0| 73 74 69 6e 61 74 69 6f | 6e 2c 20 74 68 65 20 63 |stinatio|n, the c| |00003df0| 6c 6f 73 65 73 74 20 61 | 76 61 69 6c 61 62 6c 65 |losest a|vailable| |00003e00| 20 69 6e 74 65 6e 73 69 | 74 79 20 69 73 20 65 69 | intensi|ty is ei| |00003e10| 74 68 65 72 20 30 20 28 | 62 6c 61 63 6b 29 20 6f |ther 0 (|black) o| |00003e20| 72 20 32 35 35 20 28 77 | 68 69 74 65 29 2e 20 54 |r 255 (w|hite). T| |00003e30| 68 65 20 72 65 71 75 65 | 73 74 65 64 20 69 6e 74 |he reque|sted int| |00003e40| 65 6e 73 69 74 79 20 69 | 73 20 74 68 65 20 6c 75 |ensity i|s the lu| |00003e50| 6d 69 6e 61 6e 63 65 20 | 6f 66 20 74 68 65 20 63 |minance |of the c| |00003e60| 75 72 72 65 6e 74 20 70 | 69 78 65 6c 20 70 6c 75 |urrent p|ixel plu| |00003e70| 73 20 73 6f 6d 65 0d 0d | 46 69 67 75 72 65 20 31 |s some..|Figure 1| |00003e80| 0d 47 72 61 79 20 47 72 | 61 64 61 74 69 6f 6e 73 |.Gray Gr|adations| |00003e90| 20 61 6e 64 20 4b 6f 6e | 65 6e 6e 61 20 50 69 63 | and Kon|enna Pic| |00003ea0| 74 75 72 65 64 20 55 73 | 69 6e 67 20 35 30 25 20 |tured Us|ing 50% | |00003eb0| 54 68 72 65 73 68 6f 6c | 64 0d 70 61 72 74 20 6f |Threshol|d.part o| |00003ec0| 66 20 74 68 65 20 65 72 | 72 6f 72 20 74 65 72 6d |f the er|ror term| |00003ed0| 20 6f 66 20 73 75 72 72 | 6f 75 6e 64 69 6e 67 20 | of surr|ounding | |00003ee0| 70 69 78 65 6c 73 2e 20 | 49 64 65 61 6c 6c 79 2c |pixels. |Ideally,| |00003ef0| 20 74 68 65 20 65 72 72 | 6f 72 20 74 65 72 6d 20 | the err|or term | |00003f00| 69 73 20 73 70 72 65 61 | 64 20 65 76 65 6e 6c 79 |is sprea|d evenly| |00003f10| 20 61 6d 6f 6e 67 20 61 | 6c 6c 20 73 75 72 72 6f | among a|ll surro| |00003f20| 75 6e 64 69 6e 67 20 70 | 69 78 65 6c 73 2e 20 42 |unding p|ixels. B| |00003f30| 75 74 20 74 6f 20 6d 61 | 69 6e 74 61 69 6e 20 61 |ut to ma|intain a| |00003f40| 63 63 65 70 74 61 62 6c | 65 20 70 65 72 66 6f 72 |cceptabl|e perfor| |00003f50| 6d 61 6e 63 65 2c 20 51 | 75 69 63 6b 44 72 61 77 |mance, Q|uickDraw| |00003f60| 20 75 73 65 73 20 61 20 | 73 68 6f 72 74 63 75 74 | uses a |shortcut| |00003f70| 2e 20 49 6e 20 6f 72 69 | 67 69 6e 61 6c 20 51 75 |. In ori|ginal Qu| |00003f80| 69 63 6b 44 72 61 77 2c | 20 74 68 65 20 65 72 72 |ickDraw,| the err| |00003f90| 6f 72 20 74 65 72 6d 20 | 69 73 20 70 75 73 68 65 |or term |is pushe| |00003fa0| 64 20 74 6f 20 74 68 65 | 20 72 69 67 68 74 20 6f |d to the| right o| |00003fb0| 6e 20 65 76 65 6e 20 73 | 63 61 6e 20 6c 69 6e 65 |n even s|can line| |00003fc0| 73 20 61 6e 64 20 74 6f | 20 74 68 65 20 6c 65 66 |s and to| the lef| |00003fd0| 74 20 6f 6e 20 6f 64 64 | 20 73 63 61 6e 20 6c 69 |t on odd| scan li| |00003fe0| 6e 65 73 2e 20 43 6f 6c | 6f 72 20 51 75 69 63 6b |nes. Col|or Quick| |00003ff0| 44 72 61 77 20 75 73 65 | 73 20 74 68 65 20 73 61 |Draw use|s the sa| |00004000| 6d 65 20 74 65 63 68 6e | 69 71 75 65 2c 20 65 78 |me techn|ique, ex| |00004010| 63 65 70 74 20 69 74 20 | 70 75 73 68 65 73 20 6f |cept it |pushes o| |00004020| 6e 6c 79 20 68 61 6c 66 | 20 74 68 65 20 65 72 72 |nly half| the err| |00004030| 6f 72 20 74 6f 20 74 68 | 65 20 6c 65 66 74 20 6f |or to th|e left o| |00004040| 72 20 72 69 67 68 74 2c | 20 61 6e 64 20 74 68 65 |r right,| and the| |00004050| 20 6f 74 68 65 72 20 68 | 61 6c 66 20 74 6f 20 74 | other h|alf to t| |00004060| 68 65 20 70 69 78 65 6c | 20 69 6d 6d 65 64 69 61 |he pixel| immedia| |00004070| 74 65 6c 79 20 62 65 6c | 6f 77 2e 20 54 68 65 20 |tely bel|ow. The | |00004080| 72 65 73 75 6c 74 20 6f | 66 20 75 73 69 6e 67 20 |result o|f using | |00004090| 74 68 69 73 20 74 65 63 | 68 6e 69 71 75 65 20 69 |this tec|hnique i| |000040a0| 6e 20 43 6f 6c 6f 72 20 | 51 75 69 63 6b 44 72 61 |n Color |QuickDra| |000040b0| 77 20 61 74 20 6d 6f 6e | 69 74 6f 72 20 72 65 73 |w at mon|itor res| |000040c0| 6f 6c 75 74 69 6f 6e 20 | 66 6f 72 20 74 68 65 20 |olution |for the | |000040d0| 74 77 6f 20 74 65 73 74 | 20 69 6d 61 67 65 73 20 |two test| images | |000040e0| 69 73 20 73 68 6f 77 6e | 20 69 6e 20 46 69 67 75 |is shown| in Figu| |000040f0| 72 65 20 32 2e 0d 54 68 | 69 73 20 66 6f 72 6d 20 |re 2..Th|is form | |00004100| 6f 66 20 64 69 74 68 65 | 72 69 6e 67 20 69 73 20 |of dithe|ring is | |00004110| 6e 6f 72 6d 61 6c 6c 79 | 20 72 65 66 65 72 72 65 |normally| referre| |00004120| 64 20 74 6f 20 61 73 20 | 65 72 72 6f 72 20 64 69 |d to as |error di| |00004130| 66 66 75 73 69 6f 6e 2e | 20 54 68 61 74 20 69 73 |ffusion.| That is| |00004140| 20 74 6f 20 73 61 79 20 | 74 68 61 74 20 65 61 63 | to say |that eac| |00004150| 68 20 70 69 78 65 6c 20 | 69 73 20 74 68 72 65 73 |h pixel |is thres| |00004160| 68 6f 6c 64 65 64 20 61 | 74 20 35 30 25 2c 20 62 |holded a|t 50%, b| |00004170| 75 74 20 74 68 65 20 65 | 72 72 6f 72 20 69 6e 63 |ut the e|rror inc| |00004180| 75 72 72 65 64 20 69 6e | 20 74 68 61 74 20 70 72 |urred in| that pr| |00004190| 6f 63 65 73 73 20 69 73 | 20 64 69 73 74 72 69 62 |ocess is| distrib| |000041a0| 75 74 65 64 20 61 63 72 | 6f 73 73 20 74 68 65 20 |uted acr|oss the | |000041b0| 69 6d 61 67 65 20 69 6e | 20 73 6f 6d 65 20 6d 61 |image in| some ma| |000041c0| 6e 6e 65 72 2c 20 74 68 | 75 73 20 6d 69 6e 69 6d |nner, th|us minim| |000041d0| 69 7a 69 6e 67 20 69 6e | 66 6f 72 6d 61 74 69 6f |izing in|formatio| |000041e0| 6e 20 6c 6f 73 73 2e 20 | 45 72 72 6f 72 20 64 69 |n loss. |Error di| |000041f0| 66 66 75 73 69 6f 6e 20 | 70 72 6f 64 75 63 65 73 |ffusion |produces| |00004200| 20 76 65 72 79 20 70 6c | 65 61 73 69 6e 67 20 72 | very pl|easing r| |00004210| 65 73 75 6c 74 73 20 77 | 68 65 6e 20 74 68 65 20 |esults w|hen the | |00004220| 64 65 76 69 63 65 20 62 | 65 69 6e 67 20 64 72 61 |device b|eing dra| |00004230| 77 6e 20 6f 6e 74 6f 20 | 69 73 20 63 61 70 61 62 |wn onto |is capab| |00004240| 6c 65 20 6f 66 20 61 63 | 63 75 72 61 74 65 6c 79 |le of ac|curately| |00004250| 20 72 65 6e 64 65 72 69 | 6e 67 20 61 20 73 69 6e | renderi|ng a sin| |00004260| 67 6c 65 20 64 6f 74 20 | 61 74 20 74 68 65 20 69 |gle dot |at the i| |00004270| 6d 61 67 65 20 72 65 73 | 6f 6c 75 74 69 6f 6e 2e |mage res|olution.| |00004280| 20 4d 6f 6e 69 74 6f 72 | 73 20 61 72 65 20 71 75 | Monitor|s are qu| |00004290| 69 74 65 20 67 6f 6f 64 | 20 61 74 20 74 68 69 73 |ite good| at this| |000042a0| 3b 20 6c 61 73 65 72 20 | 70 72 69 6e 74 65 72 73 |; laser |printers| |000042b0| 20 61 72 65 20 6e 6f 74 | 2e 20 49 66 20 79 6f 75 | are not|. If you| |000042c0| 20 77 61 6e 74 20 79 6f | 75 72 20 61 70 70 6c 69 | want yo|ur appli| |000042d0| 63 61 74 69 6f 6e d5 73 | 20 6f 75 74 70 75 74 20 |cation.s| output | |000042e0| 74 6f 20 6c 6f 6f 6b 20 | 67 6f 6f 64 20 6f 6e 20 |to look |good on | |000042f0| 61 20 6c 61 73 65 72 20 | 70 72 69 6e 74 65 72 2c |a laser |printer,| |00004300| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 74 65 63 | a diffe|rent tec| |00004310| 68 6e 69 71 75 65 20 69 | 73 20 63 61 6c 6c 65 64 |hnique i|s called| |00004320| 20 66 6f 72 2e 0d 55 53 | 49 4e 47 20 4f 52 44 45 | for..US|ING ORDE| |00004330| 52 45 44 20 44 49 54 48 | 45 52 49 4e 47 20 28 48 |RED DITH|ERING (H| |00004340| 41 4c 46 54 4f 4e 49 4e | 47 29 0d 54 68 65 72 65 |ALFTONIN|G).There| |00004350| 20 61 72 65 20 74 77 6f | 20 6b 69 6e 64 73 20 6f | are two| kinds o| |00004360| 66 20 6c 61 73 65 72 20 | 70 72 69 6e 74 65 72 73 |f laser |printers| |00004370| 3a 20 77 72 69 74 65 2d | 77 68 69 74 65 20 61 6e |: write-|white an| |00004380| 64 20 77 72 69 74 65 2d | 62 6c 61 63 6b 2e 20 41 |d write-|black. A| |00004390| 20 77 72 69 74 65 2d 77 | 68 69 74 65 20 70 72 69 | write-w|hite pri| |000043a0| 6e 74 65 72 20 28 73 75 | 63 68 20 61 73 20 73 6f |nter (su|ch as so| |000043b0| 6d 65 20 6f 66 20 74 68 | 65 20 68 69 67 68 2d 65 |me of th|e high-e| |000043c0| 6e 64 20 4c 69 6e 6f 74 | 72 6f 6e 69 63 20 70 72 |nd Linot|ronic pr| |000043d0| 69 6e 74 65 72 73 20 74 | 68 61 74 20 75 73 65 20 |inters t|hat use | |000043e0| 61 20 70 68 6f 74 6f 67 | 72 61 70 68 69 63 20 70 |a photog|raphic p| |000043f0| 72 6f 63 65 73 73 29 20 | 73 74 61 72 74 73 20 74 |rocess) |starts t| |00004400| 68 65 20 69 6d 61 67 65 | 20 6f 75 74 20 62 6c 61 |he image| out bla| |00004410| 63 6b 20 61 6e 64 20 75 | 73 65 73 20 74 68 65 20 |ck and u|ses the | |00004420| 6c 61 73 65 72 20 74 6f | 20 74 75 72 6e 20 6f 66 |laser to| turn of| |00004430| 66 20 70 69 78 65 6c 73 | 2e 20 41 20 77 72 69 74 |f pixels|. A writ| |00004440| 65 2d 62 6c 61 63 6b 20 | 0d 0d 20 20 20 20 20 20 |e-black |.. | |00004450| 20 20 20 20 20 20 0d 46 | 69 67 75 72 65 20 32 0d | .F|igure 2.| |00004460| 47 72 61 79 20 47 72 61 | 64 61 74 69 6f 6e 73 20 |Gray Gra|dations | |00004470| 61 6e 64 20 4b 6f 6e 65 | 6e 6e 61 20 44 69 74 68 |and Kone|nna Dith| |00004480| 65 72 65 64 20 61 74 20 | 4d 6f 6e 69 74 6f 72 20 |ered at |Monitor | |00004490| 52 65 73 6f 6c 75 74 69 | 6f 6e 0d 70 72 69 6e 74 |Resoluti|on.print| |000044a0| 65 72 20 28 73 75 63 68 | 20 61 73 20 41 70 70 6c |er (such| as Appl| |000044b0| 65 d5 73 20 4c 61 73 65 | 72 57 72 69 74 65 72 29 |e.s Lase|rWriter)| |000044c0| 20 73 74 61 72 74 73 20 | 74 68 65 20 69 6d 61 67 | starts |the imag| |000044d0| 65 20 6f 75 74 20 77 68 | 69 74 65 20 61 6e 64 20 |e out wh|ite and | |000044e0| 74 75 72 6e 73 20 6f 6e | 20 70 69 78 65 6c 73 20 |turns on| pixels | |000044f0| 77 69 74 68 20 74 68 65 | 20 6c 61 73 65 72 2e 20 |with the| laser. | |00004500| 53 69 6e 63 65 20 74 68 | 65 20 70 69 78 65 6c 73 |Since th|e pixels| |00004510| 20 61 72 65 20 74 68 6f | 75 67 68 74 20 6f 66 20 | are tho|ught of | |00004520| 61 73 20 62 65 69 6e 67 | 20 73 71 75 61 72 65 20 |as being| square | |00004530| 61 6e 64 20 74 68 65 20 | 6c 61 73 65 72 20 62 65 |and the |laser be| |00004540| 61 6d 20 69 73 20 72 6f | 75 6e 64 2c 20 6e 65 69 |am is ro|und, nei| |00004550| 74 68 65 72 20 70 72 6f | 63 65 73 73 20 63 61 6e |ther pro|cess can| |00004560| 20 61 63 63 75 72 61 74 | 65 6c 79 20 74 75 72 6e | accurat|ely turn| |00004570| 20 6f 6e 20 6f 72 20 6f | 66 66 20 73 69 6e 67 6c | on or o|ff singl| |00004580| 65 20 70 69 78 65 6c 73 | 2e 20 0d 47 65 6e 65 72 |e pixels|. .Gener| |00004590| 61 6c 6c 79 2c 20 74 68 | 65 20 63 69 72 63 6c 65 |ally, th|e circle| |000045a0| 20 67 65 6e 65 72 61 74 | 65 64 20 62 79 20 74 68 | generat|ed by th| |000045b0| 65 20 6c 61 73 65 72 20 | 62 65 61 6d 20 69 73 20 |e laser |beam is | |000045c0| 73 6c 69 67 68 74 6c 79 | 20 62 69 67 67 65 72 20 |slightly| bigger | |000045d0| 74 68 61 6e 20 74 68 65 | 20 70 69 78 65 6c 20 61 |than the| pixel a| |000045e0| 73 20 74 68 65 20 63 6f | 6d 70 75 74 65 72 20 d2 |s the co|mputer .| |000045f0| 73 65 65 73 d3 20 69 74 | 2c 20 74 6f 20 67 75 61 |sees. it|, to gua| |00004600| 72 61 6e 74 65 65 20 74 | 68 61 74 20 61 6c 6c 20 |rantee t|hat all | |00004610| 73 70 61 63 65 20 69 73 | 20 63 6f 76 65 72 65 64 |space is| covered| |00004620| 20 28 73 65 65 20 46 69 | 67 75 72 65 20 33 29 2e | (see Fi|gure 3).| |00004630| 20 54 68 65 20 65 66 66 | 65 63 74 20 6f 66 20 74 | The eff|ect of t| |00004640| 68 69 73 20 77 69 74 68 | 20 61 20 77 72 69 74 65 |his with| a write| |00004650| 2d 62 6c 61 63 6b 20 70 | 72 69 6e 74 65 72 20 69 |-black p|rinter i| |00004660| 73 20 74 68 61 74 20 74 | 68 65 20 62 6c 61 63 6b |s that t|he black| |00004670| 20 64 6f 74 73 20 74 65 | 6e 64 20 74 6f 20 62 65 | dots te|nd to be| |00004680| 20 62 69 67 67 65 72 20 | 74 68 61 6e 20 74 68 65 | bigger |than the| |00004690| 20 69 6e 64 69 76 69 64 | 75 61 6c 20 70 69 78 65 | individ|ual pixe| |000046a0| 6c 73 2c 20 63 61 75 73 | 69 6e 67 20 61 6e 79 20 |ls, caus|ing any | |000046b0| 31 2d 62 69 74 20 69 6d | 61 67 65 20 64 72 61 77 |1-bit im|age draw| |000046c0| 6e 20 61 74 20 64 65 76 | 69 63 65 20 72 65 73 6f |n at dev|ice reso| |000046d0| 6c 75 74 69 6f 6e 20 74 | 6f 20 61 70 70 65 61 72 |lution t|o appear| |000046e0| 20 74 6f 6f 20 64 61 72 | 6b 2e 20 54 68 65 20 65 | too dar|k. The e| |000046f0| 66 66 65 63 74 20 77 69 | 74 68 20 61 20 77 72 69 |ffect wi|th a wri| |00004700| 74 65 2d 77 68 69 74 65 | 20 70 72 69 6e 74 65 72 |te-white| printer| |00004710| 20 69 73 20 74 68 61 74 | 20 74 68 65 20 62 6c 61 | is that| the bla| |00004720| 63 6b 20 64 6f 74 73 20 | 74 65 6e 64 20 74 6f 20 |ck dots |tend to | |00004730| 62 65 20 73 6d 61 6c 6c | 65 72 20 74 68 61 6e 20 |be small|er than | |00004740| 74 68 65 20 69 6e 64 69 | 76 69 64 75 61 6c 20 70 |the indi|vidual p| |00004750| 69 78 65 6c 73 2c 20 63 | 61 75 73 69 6e 67 20 61 |ixels, c|ausing a| |00004760| 6e 79 20 31 2d 62 69 74 | 20 69 6d 61 67 65 20 64 |ny 1-bit| image d| |00004770| 72 61 77 6e 20 61 74 20 | 64 65 76 69 63 65 20 72 |rawn at |device r| |00004780| 65 73 6f 6c 75 74 69 6f | 6e 20 74 6f 20 61 70 70 |esolutio|n to app| |00004790| 65 61 72 20 74 6f 6f 20 | 6c 69 67 68 74 2e 20 49 |ear too |light. I| |000047a0| 66 20 74 68 65 20 61 72 | 65 61 20 6f 66 20 74 68 |f the ar|ea of th| |000047b0| 65 20 63 69 72 63 6c 65 | 20 69 73 20 32 30 25 20 |e circle| is 20% | |000047c0| 67 72 65 61 74 65 72 20 | 74 68 61 6e 20 74 68 65 |greater |than the| |000047d0| 20 69 6e 64 69 76 69 64 | 75 61 6c 20 70 69 78 65 | individ|ual pixe| |000047e0| 6c 2c 20 74 68 65 20 70 | 65 72 63 65 6e 74 61 67 |l, the p|ercentag| |000047f0| 65 20 6f 66 20 75 6e 77 | 61 6e 74 65 64 20 74 6f |e of unw|anted to| |00004800| 6e 65 72 2c 20 6f 72 20 | 65 72 72 6f 72 2c 20 66 |ner, or |error, f| |00004810| 6f 72 20 61 20 73 69 6e | 67 6c 65 20 70 69 78 65 |or a sin|gle pixe| |00004820| 6c 20 69 73 20 32 30 25 | 2e 0d 46 69 67 75 72 65 |l is 20%|..Figure| |00004830| 20 33 0d 41 20 4c 61 73 | 65 72 d5 73 20 49 64 65 | 3.A Las|er.s Ide| |00004840| 61 20 6f 66 20 61 20 53 | 71 75 61 72 65 20 50 69 |a of a S|quare Pi| |00004850| 78 65 6c 0d 0d 42 65 63 | 61 75 73 65 20 74 68 65 |xel..Bec|ause the| |00004860| 20 65 72 72 6f 72 20 69 | 73 20 69 6e 74 72 6f 64 | error i|s introd| |00004870| 75 63 65 64 20 6f 6e 6c | 79 20 61 74 20 74 68 65 |uced onl|y at the| |00004880| 20 62 6c 61 63 6b 2f 77 | 68 69 74 65 20 62 6f 75 | black/w|hite bou| |00004890| 6e 64 61 72 69 65 73 2c | 20 69 74 d5 73 20 72 65 |ndaries,| it.s re| |000048a0| 64 75 63 65 64 20 77 68 | 65 6e 20 74 77 6f 20 6f |duced wh|en two o| |000048b0| 72 20 6d 6f 72 65 20 70 | 69 78 65 6c 73 20 61 72 |r more p|ixels ar| |000048c0| 65 20 64 72 61 77 6e 20 | 6e 65 78 74 20 74 6f 20 |e drawn |next to | |000048d0| 65 61 63 68 20 6f 74 68 | 65 72 2e 20 54 68 65 6e |each oth|er. Then| |000048e0| 20 74 68 65 20 70 65 72 | 63 65 6e 74 61 67 65 20 | the per|centage | |000048f0| 6f 66 20 65 72 72 6f 72 | 20 69 73 20 72 65 64 75 |of error| is redu| |00004900| 63 65 64 20 74 6f 20 74 | 68 65 20 70 65 72 69 6d |ced to t|he perim| |00004910| 65 74 65 72 20 6f 66 20 | 74 68 65 20 70 69 78 65 |eter of |the pixe| |00004920| 6c 20 67 72 6f 75 70 2e | 20 53 6f 20 69 6e 20 74 |l group.| So in t| |00004930| 68 65 20 63 61 73 65 20 | 77 68 65 72 65 20 74 68 |he case |where th| |00004940| 65 20 65 72 72 6f 72 20 | 66 6f 72 20 61 20 73 69 |e error |for a si| |00004950| 6e 67 6c 65 20 70 69 78 | 65 6c 20 69 73 20 32 30 |ngle pix|el is 20| |00004960| 25 2c 20 74 77 6f 20 70 | 69 78 65 6c 73 20 64 72 |%, two p|ixels dr| |00004970| 61 77 6e 20 6e 65 78 74 | 20 74 6f 20 65 61 63 68 |awn next| to each| |00004980| 20 6f 74 68 65 72 20 77 | 6f 75 6c 64 20 68 61 76 | other w|ould hav| |00004990| 65 20 6f 6e 6c 79 20 61 | 20 31 35 2e 35 25 20 65 |e only a| 15.5% e| |000049a0| 72 72 6f 72 2c 20 61 6e | 64 20 66 6f 75 72 20 70 |rror, an|d four p| |000049b0| 69 78 65 6c 73 20 69 6e | 20 61 20 73 71 75 61 72 |ixels in| a squar| |000049c0| 65 20 77 6f 75 6c 64 20 | 68 61 76 65 20 6f 6e 6c |e would |have onl| |000049d0| 79 20 61 20 31 30 2e 32 | 35 25 20 65 72 72 6f 72 |y a 10.2|5% error| |000049e0| 20 69 6e 20 74 68 65 20 | 61 72 65 61 20 63 6f 76 | in the |area cov| |000049f0| 65 72 65 64 2e 0d 4f 72 | 64 65 72 65 64 20 64 69 |ered..Or|dered di| |00004a00| 74 68 65 72 69 6e 67 2c | 20 6f 72 20 68 61 6c 66 |thering,| or half| |00004a10| 74 6f 6e 69 6e 67 2c 20 | 6d 69 6e 69 6d 69 7a 65 |toning, |minimize| |00004a20| 73 20 74 68 65 20 64 6f | 74 2d 74 6f 2d 70 69 78 |s the do|t-to-pix| |00004a30| 65 6c 20 65 72 72 6f 72 | 20 6a 75 73 74 20 64 65 |el error| just de| |00004a40| 73 63 72 69 62 65 64 20 | 62 79 20 63 6c 75 6d 70 |scribed |by clump| |00004a50| 69 6e 67 20 70 69 78 65 | 6c 73 2e 20 50 69 78 65 |ing pixe|ls. Pixe| |00004a60| 6c 73 20 61 72 65 20 74 | 75 72 6e 65 64 20 6f 6e |ls are t|urned on| |00004a70| 20 61 6e 64 20 6f 66 66 | 20 69 6e 20 61 20 73 70 | and off| in a sp| |00004a80| 65 63 69 66 69 63 20 6f | 72 64 65 72 20 69 6e 20 |ecific o|rder in | |00004a90| 72 65 6c 61 74 69 6f 6e | 20 74 6f 20 65 61 63 68 |relation| to each| |00004aa0| 20 6f 74 68 65 72 20 61 | 6e 64 20 74 68 65 20 6c | other a|nd the l| |00004ab0| 75 6d 69 6e 61 6e 63 65 | 20 6f 66 20 74 68 65 20 |uminance| of the | |00004ac0| 73 6f 75 72 63 65 20 69 | 6d 61 67 65 2e 20 54 68 |source i|mage. Th| |00004ad0| 65 20 6f 72 64 65 72 20 | 63 61 6e 20 62 65 20 73 |e order |can be s| |00004ae0| 70 65 63 69 66 69 65 64 | 20 69 6e 20 73 75 63 68 |pecified| in such| |00004af0| 20 61 20 77 61 79 20 74 | 68 61 74 20 63 6c 75 6d | a way t|hat clum| |00004b00| 70 73 20 6f 66 20 70 69 | 78 65 6c 73 20 6e 65 78 |ps of pi|xels nex| |00004b10| 74 20 74 6f 20 65 61 63 | 68 20 6f 74 68 65 72 20 |t to eac|h other | |00004b20| 61 72 65 20 74 75 72 6e | 65 64 20 6f 6e 20 61 73 |are turn|ed on as| |00004b30| 20 74 68 65 20 6c 75 6d | 69 6e 61 6e 63 65 20 64 | the lum|inance d| |00004b40| 65 63 72 65 61 73 65 73 | 2e 20 54 68 69 73 20 61 |ecreases|. This a| |00004b50| 6c 6c 6f 77 73 20 75 73 | 20 74 6f 20 6d 69 6e 69 |llows us| to mini| |00004b60| 6d 69 7a 65 20 74 68 65 | 20 65 66 66 65 63 74 73 |mize the| effects| |00004b70| 20 6f 66 20 74 68 65 20 | 6c 61 73 65 72 20 70 72 | of the |laser pr| |00004b80| 69 6e 74 65 72 d5 73 20 | 64 6f 74 2d 74 6f 2d 70 |inter.s |dot-to-p| |00004b90| 69 78 65 6c 20 65 72 72 | 6f 72 2e 20 54 68 65 20 |ixel err|or. The | |00004ba0| 6f 72 64 65 72 20 69 73 | 20 64 65 74 65 72 6d 69 |order is| determi| |00004bb0| 6e 65 64 20 62 79 20 77 | 68 61 74 d5 73 20 6b 6e |ned by w|hat.s kn| |00004bc0| 6f 77 6e 20 61 73 20 61 | 20 64 69 74 68 65 72 20 |own as a| dither | |00004bd0| 6d 61 74 72 69 78 2e 20 | 28 57 61 72 6e 69 6e 67 |matrix. |(Warning| |00004be0| 3a 20 46 72 6f 6d 20 68 | 65 72 65 20 6f 6e 20 6f |: From h|ere on o| |00004bf0| 75 74 2c 20 74 68 69 6e | 67 73 20 67 65 74 20 64 |ut, thin|gs get d| |00004c00| 65 65 70 2c 20 73 6f 20 | 70 75 74 20 6f 6e 20 79 |eep, so |put on y| |00004c10| 6f 75 72 20 77 61 64 65 | 72 73 2e 20 59 6f 75 20 |our wade|rs. You | |00004c20| 64 6f 6e d5 74 20 72 65 | 61 6c 6c 79 20 6e 65 65 |don.t re|ally nee| |00004c30| 64 20 74 6f 20 75 6e 64 | 65 72 73 74 61 6e 64 20 |d to und|erstand | |00004c40| 61 6c 6c 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |all the |followin| |00004c50| 67 20 74 6f 20 75 73 65 | 20 74 68 65 20 73 61 6d |g to use| the sam| |00004c60| 70 6c 65 20 63 6f 64 65 | 20 77 65 20 70 72 6f 76 |ple code| we prov| |00004c70| 69 64 65 2e 29 0d 41 62 | 6f 75 74 20 74 68 65 20 |ide.).Ab|out the | |00004c80| 64 69 74 68 65 72 20 6d | 61 74 72 69 78 2e 20 57 |dither m|atrix. W| |00004c90| 69 74 68 20 61 20 64 69 | 74 68 65 72 20 6d 61 74 |ith a di|ther mat| |00004ca0| 72 69 78 2c 20 74 6f 20 | 72 65 6e 64 65 72 20 69 |rix, to |render i| |00004cb0| 6e 74 65 72 6d 65 64 69 | 61 74 65 20 73 68 61 64 |ntermedi|ate shad| |00004cc0| 65 73 20 6f 66 20 67 72 | 61 79 20 6f 72 20 70 72 |es of gr|ay or pr| |00004cd0| 69 6d 61 72 79 20 63 6f | 6c 6f 72 73 2c 20 77 65 |imary co|lors, we| |00004ce0| 20 73 61 63 72 69 66 69 | 63 65 20 73 70 61 74 69 | sacrifi|ce spati| |00004cf0| 61 6c 20 72 65 73 6f 6c | 75 74 69 6f 6e 20 66 6f |al resol|ution fo| |00004d00| 72 20 73 68 61 64 69 6e | 67 d1 74 68 61 74 20 69 |r shadin|g.that i| |00004d10| 73 2c 20 77 65 20 65 66 | 66 65 63 74 69 76 65 6c |s, we ef|fectivel| |00004d20| 79 20 6c 6f 77 65 72 20 | 74 68 65 20 64 65 76 69 |y lower |the devi| |00004d30| 63 65 d5 73 20 64 6f 74 | 73 2d 70 65 72 2d 69 6e |ce.s dot|s-per-in| |00004d40| 63 68 20 72 61 74 69 6e | 67 20 77 68 69 6c 65 20 |ch ratin|g while | |00004d50| 69 6e 63 72 65 61 73 69 | 6e 67 20 74 68 65 20 6e |increasi|ng the n| |00004d60| 75 6d 62 65 72 20 6f 66 | 20 73 68 61 64 65 73 20 |umber of| shades | |00004d70| 74 68 61 74 20 77 65 20 | 63 61 6e 20 70 72 69 6e |that we |can prin| |00004d80| 74 2e 20 46 6f 72 20 65 | 78 61 6d 70 6c 65 2c 20 |t. For e|xample, | |00004d90| 69 66 20 77 65 20 75 73 | 65 20 61 20 32 78 32 20 |if we us|e a 2x2 | |00004da0| 63 65 6c 6c 20 6f 66 20 | 33 30 30 2d 64 70 69 20 |cell of |300-dpi | |00004db0| 64 6f 74 73 20 66 6f 72 | 20 65 76 65 72 79 20 70 |dots for| every p| |00004dc0| 69 78 65 6c 20 6f 6e 20 | 74 68 65 20 70 61 67 65 |ixel on |the page| |00004dd0| 2c 20 77 65 d5 76 65 20 | 6c 6f 77 65 72 65 64 20 |, we.ve |lowered | |00004de0| 74 68 65 20 73 70 61 74 | 69 61 6c 20 72 65 73 6f |the spat|ial reso| |00004df0| 6c 75 74 69 6f 6e 20 6f | 66 20 74 68 65 20 64 65 |lution o|f the de| |00004e00| 76 69 63 65 20 74 6f 20 | 31 35 30 20 64 70 69 20 |vice to |150 dpi | |00004e10| 62 75 74 20 77 65 20 6e | 6f 77 20 68 61 76 65 20 |but we n|ow have | |00004e20| 32 34 20 6f 72 20 31 36 | 20 64 69 66 66 65 72 65 |24 or 16| differe| |00004e30| 6e 74 20 70 61 74 74 65 | 72 6e 73 20 74 6f 20 63 |nt patte|rns to c| |00004e40| 68 6f 6f 73 65 20 66 72 | 6f 6d 20 66 6f 72 20 65 |hoose fr|om for e| |00004e50| 61 63 68 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 70 |ach one |of the p| |00004e60| 69 78 65 6c 73 2e 20 45 | 61 63 68 20 70 61 74 74 |ixels. E|ach patt| |00004e70| 65 72 6e 20 68 61 73 20 | 61 6e 79 77 68 65 72 65 |ern has |anywhere| |00004e80| 20 66 72 6f 6d 20 30 20 | 74 6f 20 34 20 6f 66 20 | from 0 |to 4 of | |00004e90| 74 68 65 20 33 30 30 2d | 64 70 69 20 64 6f 74 73 |the 300-|dpi dots| |00004ea0| 20 62 6c 61 63 6b 65 6e | 65 64 2c 20 6f 72 20 61 | blacken|ed, or a| |00004eb0| 20 64 65 6e 73 69 74 79 | 20 62 65 74 77 65 65 6e | density| between| |00004ec0| 20 30 20 61 6e 64 20 31 | 30 30 25 2e 20 49 6e 20 | 0 and 1|00%. In | |00004ed0| 66 61 63 74 2c 20 66 6f | 72 20 74 68 65 20 31 36 |fact, fo|r the 16| |00004ee0| 20 70 6f 73 73 69 62 6c | 65 20 70 61 74 74 65 72 | possibl|e patter| |00004ef0| 6e 73 20 74 68 65 72 65 | 20 61 72 65 20 6f 6e 6c |ns there| are onl| |00004f00| 79 20 66 69 76 65 20 70 | 6f 73 73 69 62 6c 65 20 |y five p|ossible | |00004f10| 64 65 6e 73 69 74 69 65 | 73 3a 20 30 25 2c 20 32 |densitie|s: 0%, 2| |00004f20| 35 25 2c 20 35 30 25 2c | 20 37 35 25 2c 20 61 6e |5%, 50%,| 75%, an| |00004f30| 64 20 31 30 30 25 2c 20 | 63 6f 72 72 65 73 70 6f |d 100%, |correspo| |00004f40| 6e 64 69 6e 67 20 74 6f | 20 30 2c 20 31 2c 20 32 |nding to| 0, 1, 2| |00004f50| 2c 20 33 2c 20 61 6e 64 | 20 34 20 64 6f 74 73 20 |, 3, and| 4 dots | |00004f60| 62 6c 61 63 6b 65 6e 65 | 64 20 69 6e 20 74 68 65 |blackene|d in the| |00004f70| 20 63 65 6c 6c 2e 20 54 | 68 65 20 64 69 74 68 65 | cell. T|he dithe| |00004f80| 72 20 6d 61 74 72 69 78 | 20 64 65 74 65 72 6d 69 |r matrix| determi| |00004f90| 6e 65 73 20 77 68 69 63 | 68 20 66 69 76 65 20 6f |nes whic|h five o| |00004fa0| 66 20 74 68 65 20 70 6f | 73 73 69 62 6c 65 20 70 |f the po|ssible p| |00004fb0| 61 74 74 65 72 6e 73 20 | 74 6f 20 75 73 65 20 74 |atterns |to use t| |00004fc0| 6f 20 72 65 70 72 65 73 | 65 6e 74 20 74 68 65 20 |o repres|ent the | |00004fd0| 66 69 76 65 20 70 6f 73 | 73 69 62 6c 65 20 64 65 |five pos|sible de| |00004fe0| 6e 73 69 74 69 65 73 2e | 20 49 74 d5 73 20 6c 65 |nsities.| It.s le| |00004ff0| 66 74 20 74 6f 20 79 6f | 75 20 61 73 20 61 6e 20 |ft to yo|u as an | |00005000| 65 78 65 72 63 69 73 65 | 20 74 6f 20 67 65 6e 65 |exercise| to gene| |00005010| 72 61 74 65 20 74 68 65 | 73 65 20 6d 61 74 72 69 |rate the|se matri| |00005020| 78 65 73 20 75 73 69 6e | 67 20 74 68 65 20 61 6c |xes usin|g the al| |00005030| 67 6f 72 69 74 68 6d 20 | 77 65 20 70 72 6f 76 69 |gorithm |we provi| |00005040| 64 65 20 62 65 6c 6f 77 | 2e 20 28 54 68 65 20 73 |de below|. (The s| |00005050| 61 6d 70 6c 65 20 63 6f | 64 65 20 6f 6e 20 74 68 |ample co|de on th| |00005060| 65 20 44 65 76 65 6c 6f | 70 65 72 20 43 44 20 53 |e Develo|per CD S| |00005070| 65 72 69 65 73 20 64 69 | 73 63 20 68 61 73 20 61 |eries di|sc has a| |00005080| 20 63 6f 6d 6d 6f 6e 6c | 79 20 75 73 65 66 75 6c | commonl|y useful| |00005090| 20 65 78 61 6d 70 6c 65 | 2e 29 0d 49 66 20 77 65 | example|.).If we| |000050a0| 20 63 6f 6e 73 74 72 75 | 63 74 20 61 20 6d 61 74 | constru|ct a mat| |000050b0| 72 69 78 20 77 69 74 68 | 20 74 68 65 20 73 61 6d |rix with| the sam| |000050c0| 65 20 64 69 6d 65 6e 73 | 69 6f 6e 73 20 61 73 20 |e dimens|ions as | |000050d0| 74 68 65 20 64 6f 74 20 | 63 65 6c 6c 20 74 68 61 |the dot |cell tha| |000050e0| 74 20 77 65 d5 72 65 20 | 67 6f 69 6e 67 20 74 6f |t we.re |going to| |000050f0| 20 75 73 65 20 28 32 78 | 32 20 66 6f 72 20 74 68 | use (2x|2 for th| |00005100| 65 20 64 65 73 63 72 69 | 62 65 64 20 63 61 73 65 |e descri|bed case| |00005110| 29 20 73 6f 20 74 68 61 | 74 20 74 68 65 20 6d 61 |) so tha|t the ma| |00005120| 74 72 69 78 20 63 6f 6e | 74 61 69 6e 73 20 74 68 |trix con|tains th| |00005130| 65 20 76 61 6c 75 65 73 | 20 32 35 2c 20 35 30 2c |e values| 25, 50,| |00005140| 20 37 35 2c 20 61 6e 64 | 20 31 30 30 2c 20 77 65 | 75, and| 100, we| |00005150| 20 63 61 6e 20 75 73 65 | 20 74 68 69 73 20 6d 61 | can use| this ma| |00005160| 74 72 69 78 20 74 6f 20 | 64 65 74 65 72 6d 69 6e |trix to |determin| |00005170| 65 20 65 61 63 68 20 6f | 66 20 74 68 65 20 66 69 |e each o|f the fi| |00005180| 76 65 20 70 6f 73 73 69 | 62 6c 65 20 70 61 74 74 |ve possi|ble patt| |00005190| 65 72 6e 73 2e 20 45 61 | 63 68 20 64 6f 74 20 69 |erns. Ea|ch dot i| |000051a0| 6e 20 74 68 65 20 70 61 | 74 74 65 72 6e 20 63 6f |n the pa|ttern co| |000051b0| 72 72 65 73 70 6f 6e 64 | 73 20 74 6f 20 61 20 70 |rrespond|s to a p| |000051c0| 6f 73 69 74 69 6f 6e 20 | 69 6e 20 74 68 65 20 6d |osition |in the m| |000051d0| 61 74 72 69 78 2e 20 54 | 6f 20 67 65 6e 65 72 61 |atrix. T|o genera| |000051e0| 74 65 20 61 20 70 61 74 | 74 65 72 6e 20 66 6f 72 |te a pat|tern for| |000051f0| 20 35 30 25 20 67 72 61 | 79 2c 20 77 65 20 74 75 | 50% gra|y, we tu| |00005200| 72 6e 20 6f 6e 20 61 6c | 6c 20 74 68 65 20 64 6f |rn on al|l the do| |00005210| 74 73 20 69 6e 20 74 68 | 65 20 70 61 74 74 65 72 |ts in th|e patter| |00005220| 6e 20 77 69 74 68 20 63 | 6f 72 72 65 73 70 6f 6e |n with c|orrespon| |00005230| 64 69 6e 67 20 6d 61 74 | 72 69 78 20 76 61 6c 75 |ding mat|rix valu| |00005240| 65 73 20 6c 65 73 73 20 | 74 68 61 6e 20 6f 72 20 |es less |than or | |00005250| 65 71 75 61 6c 20 74 6f | 20 35 30 2e 20 54 68 65 |equal to| 50. The| |00005260| 20 70 6f 73 69 74 69 6f | 6e 20 6f 66 20 74 68 65 | positio|n of the| |00005270| 20 76 61 6c 75 65 73 20 | 69 6e 20 74 68 65 20 6d | values |in the m| |00005280| 61 74 72 69 78 20 64 65 | 74 65 72 6d 69 6e 65 73 |atrix de|termines| |00005290| 20 74 68 65 20 73 68 61 | 70 65 20 6f 66 20 74 68 | the sha|pe of th| |000052a0| 65 20 70 61 74 74 65 72 | 6e 2c 20 61 73 20 73 68 |e patter|n, as sh| |000052b0| 6f 77 6e 20 69 6e 20 46 | 69 67 75 72 65 20 34 2e |own in F|igure 4.| |000052c0| 0d 54 68 65 20 64 69 74 | 68 65 72 20 6d 61 74 72 |.The dit|her matr| |000052d0| 69 78 20 69 73 20 75 73 | 65 64 20 74 6f 20 72 65 |ix is us|ed to re| |000052e0| 6e 64 65 72 20 61 6e 20 | 69 6d 61 67 65 20 69 6e |nder an |image in| |000052f0| 20 6d 75 63 68 20 74 68 | 65 20 73 61 6d 65 20 77 | much th|e same w| |00005300| 61 79 20 61 73 20 74 68 | 65 20 35 30 25 20 74 68 |ay as th|e 50% th| |00005310| 72 65 73 68 6f 6c 64 20 | 64 65 73 63 72 69 62 65 |reshold |describe| |00005320| 64 20 65 61 72 6c 69 65 | 72 2e 20 49 6e 20 66 61 |d earlie|r. In fa| |00005330| 63 74 2c 20 74 68 61 74 | 20 70 72 6f 63 65 73 73 |ct, that| process| |00005340| 20 75 73 65 73 20 61 20 | 31 78 31 20 64 69 74 68 | uses a |1x1 dith| |00005350| 65 72 20 6d 61 74 72 69 | 78 20 77 68 6f 73 65 20 |er matri|x whose | |00005360| 73 69 6e 67 6c 65 20 65 | 6c 65 6d 65 6e 74 20 68 |single e|lement h| |00005370| 61 73 20 61 20 76 61 6c | 75 65 20 6f 66 20 35 30 |as a val|ue of 50| |00005380| 25 2e 20 54 68 65 20 64 | 69 74 68 65 72 20 6d 61 |%. The d|ither ma| |00005390| 74 72 69 78 20 69 73 20 | 73 61 6d 70 6c 65 64 20 |trix is |sampled | |000053a0| 77 69 74 68 20 28 78 20 | 6d 6f 64 20 6d 2c 20 79 |with (x |mod m, y| |000053b0| 20 6d 6f 64 20 6e 29 2c | 20 77 68 65 72 65 20 28 | mod n),| where (| |000053c0| 78 2c 20 79 29 20 69 73 | 20 74 68 65 20 64 65 76 |x, y) is| the dev| |000053d0| 69 63 65 20 70 69 78 65 | 6c 20 6c 6f 63 61 74 69 |ice pixe|l locati| |000053e0| 6f 6e 20 61 6e 64 20 28 | 6d 2c 20 6e 29 20 69 73 |on and (|m, n) is| |000053f0| 20 74 68 65 20 77 69 64 | 74 68 20 61 6e 64 20 68 | the wid|th and h| |00005400| 65 69 67 68 74 20 6f 66 | 20 74 68 65 20 64 69 74 |eight of| the dit| |00005410| 68 65 72 20 6d 61 74 72 | 69 78 2e 0d 49 74 20 74 |her matr|ix..It t| |00005420| 75 72 6e 73 20 6f 75 74 | 20 74 68 61 74 20 74 68 |urns out| that th| |00005430| 65 20 73 70 61 74 69 61 | 6c 20 72 65 73 6f 6c 75 |e spatia|l resolu| |00005440| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 64 65 76 69 |tion of |the devi| |00005450| 63 65 20 69 73 6e d5 74 | 20 72 65 61 6c 6c 79 20 |ce isn.t| really | |00005460| 72 65 64 75 63 65 64 20 | 62 79 20 74 68 65 20 73 |reduced |by the s| |00005470| 69 7a 65 20 6f 66 20 74 | 68 65 20 64 69 74 68 65 |ize of t|he dithe| |00005480| 72 20 6d 61 74 72 69 78 | 2e 20 46 6f 72 20 72 65 |r matrix|. For re| |00005490| 67 69 6f 6e 73 20 74 68 | 61 74 20 61 72 65 20 61 |gions th|at are a| |000054a0| 6c 6c 20 62 6c 61 63 6b | 2c 20 66 6f 72 20 65 78 |ll black|, for ex| |000054b0| 61 6d 70 6c 65 2c 20 74 | 68 65 20 72 65 73 6f 6c |ample, t|he resol| |000054c0| 75 74 69 6f 6e 20 72 65 | 6d 61 69 6e 73 20 0d 09 |ution re|mains ..| |000054d0| 44 69 74 68 65 72 20 6d | 61 74 72 69 78 09 35 30 |Dither m|atrix.50| |000054e0| 25 20 67 72 61 79 20 70 | 61 74 74 65 72 6e 0d 46 |% gray p|attern.F| |000054f0| 69 67 75 72 65 20 34 0d | 41 20 32 78 32 20 44 69 |igure 4.|A 2x2 Di| |00005500| 74 68 65 72 20 4d 61 74 | 72 69 78 0d 74 68 65 20 |ther Mat|rix.the | |00005510| 64 65 76 69 63 65 20 72 | 65 73 6f 6c 75 74 69 6f |device r|esolutio| |00005520| 6e 2e 20 45 61 63 68 20 | 70 69 78 65 6c 20 69 6e |n. Each |pixel in| |00005530| 20 74 68 65 20 64 65 76 | 69 63 65 20 69 73 20 73 | the dev|ice is s| |00005540| 74 69 6c 6c 20 73 61 6d | 70 6c 65 64 20 62 61 63 |till sam|pled bac| |00005550| 6b 20 74 6f 20 61 20 70 | 69 78 65 6c 20 69 6e 20 |k to a p|ixel in | |00005560| 74 68 65 20 73 6f 75 72 | 63 65 20 69 6d 61 67 65 |the sour|ce image| |00005570| 2e 0d 54 68 65 20 62 61 | 73 69 63 20 61 6c 67 6f |..The ba|sic algo| |00005580| 72 69 74 68 6d 20 66 6f | 72 20 64 6f 69 6e 67 20 |rithm fo|r doing | |00005590| 61 6e 20 6f 72 64 65 72 | 65 64 20 64 69 74 68 65 |an order|ed dithe| |000055a0| 72 20 6f 66 20 61 6e 20 | 69 6d 61 67 65 20 6f 6e |r of an |image on| |000055b0| 74 6f 20 61 20 70 61 67 | 65 20 62 65 63 6f 6d 65 |to a pag|e become| |000055c0| 73 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 3a |s the fo|llowing:| |000055d0| 0d 46 6f 72 20 61 6c 6c | 20 64 65 76 69 63 65 20 |.For all| device | |000055e0| 70 69 78 65 6c 73 20 78 | 2c 20 79 3a 0d a5 09 73 |pixels x|, y:...s| |000055f0| 78 2c 20 73 79 20 3d 20 | 74 72 61 6e 73 66 6f 72 |x, sy = |transfor| |00005600| 6d 28 78 2c 20 79 29 20 | 77 68 65 72 65 20 74 72 |m(x, y) |where tr| |00005610| 61 6e 73 66 6f 72 6d 20 | 6d 61 70 73 20 64 65 76 |ansform |maps dev| |00005620| 69 63 65 20 70 69 78 65 | 6c 20 63 6f 6f 72 64 69 |ice pixe|l coordi| |00005630| 6e 61 74 65 73 20 74 6f | 20 73 6f 75 72 63 65 20 |nates to| source | |00005640| 70 69 78 65 6c 20 63 6f | 6f 72 64 69 6e 61 74 65 |pixel co|ordinate| |00005650| 73 0d a5 09 49 66 20 73 | 6f 75 72 63 65 4c 75 6d |s...If s|ourceLum| |00005660| 69 6e 61 6e 63 65 28 73 | 78 2c 20 73 79 29 20 3e |inance(s|x, sy) >| |00005670| 20 64 69 74 68 65 72 4d | 61 74 72 69 78 5b 78 20 | ditherM|atrix[x | |00005680| 6d 6f 64 20 6d 2c 20 79 | 20 6d 6f 64 20 6e 5d 2c |mod m, y| mod n],| |00005690| 20 64 65 76 69 63 65 2d | 64 6f 74 28 78 2c 20 79 | device-|dot(x, y| |000056a0| 29 20 3d 20 62 6c 61 63 | 6b 0d 54 68 65 20 63 6f |) = blac|k.The co| |000056b0| 64 65 20 6f 6e 20 74 68 | 65 20 44 65 76 65 6c 6f |de on th|e Develo| |000056c0| 70 65 72 20 43 44 20 53 | 65 72 69 65 73 20 64 69 |per CD S|eries di| |000056d0| 73 63 20 69 73 20 61 6e | 20 65 6c 61 62 6f 72 61 |sc is an| elabora| |000056e0| 74 69 6f 6e 20 6f 6e 20 | 74 68 69 73 20 62 61 73 |tion on |this bas| |000056f0| 69 63 20 61 6c 67 6f 72 | 69 74 68 6d 2e 0d 41 73 |ic algor|ithm..As| |00005700| 20 73 74 61 74 65 64 20 | 62 65 66 6f 72 65 2c 20 | stated |before, | |00005710| 74 68 65 20 70 6f 73 69 | 74 69 6f 6e 20 6f 66 20 |the posi|tion of | |00005720| 74 68 65 20 76 61 72 69 | 6f 75 73 20 76 61 6c 75 |the vari|ous valu| |00005730| 65 73 20 69 6e 20 74 68 | 65 20 64 69 74 68 65 72 |es in th|e dither| |00005740| 20 6d 61 74 72 69 78 20 | 64 65 74 65 72 6d 69 6e | matrix |determin| |00005750| 65 73 20 74 68 65 20 70 | 61 74 74 65 72 6e 73 20 |es the p|atterns | |00005760| 74 68 61 74 20 76 61 72 | 69 6f 75 73 20 6c 75 6d |that var|ious lum| |00005770| 69 6e 61 6e 63 65 73 20 | 67 65 6e 65 72 61 74 65 |inances |generate| |00005780| 2e 20 41 20 67 65 6e 65 | 72 61 6c 20 77 61 79 20 |. A gene|ral way | |00005790| 74 6f 20 73 70 65 63 69 | 66 79 20 74 68 69 73 20 |to speci|fy this | |000057a0| 6f 72 64 65 72 20 69 73 | 20 74 6f 20 75 73 65 20 |order is| to use | |000057b0| 61 20 73 70 6f 74 20 66 | 75 6e 63 74 69 6f 6e 2c |a spot f|unction,| |000057c0| 20 61 73 20 74 68 65 20 | 50 6f 73 74 53 63 72 69 | as the |PostScri| |000057d0| 70 74 20 69 6e 74 65 72 | 70 72 65 74 65 72 20 64 |pt inter|preter d| |000057e0| 6f 65 73 2e 20 49 66 20 | 74 68 65 20 72 65 63 74 |oes. If |the rect| |000057f0| 61 6e 67 6c 65 20 6f 66 | 20 74 68 65 20 64 69 74 |angle of| the dit| |00005800| 68 65 72 20 6d 61 74 72 | 69 78 20 69 73 20 74 68 |her matr|ix is th| |00005810| 6f 75 67 68 74 20 74 6f | 20 62 65 20 61 20 63 6f |ought to| be a co| |00005820| 6e 74 69 6e 75 6f 75 73 | 20 73 70 61 63 65 20 77 |ntinuous| space w| |00005830| 68 6f 73 65 20 64 6f 6d | 61 69 6e 20 69 73 20 30 |hose dom|ain is 0| |00005840| d0 31 20 69 6e 20 74 68 | 65 20 78 20 61 6e 64 20 |.1 in th|e x and | |00005850| 79 20 64 69 72 65 63 74 | 69 6f 6e 73 2c 20 73 70 |y direct|ions, sp| |00005860| 6f 74 2d 66 75 6e 63 74 | 69 6f 6e 28 78 2c 20 79 |ot-funct|ion(x, y| |00005870| 29 20 77 69 6c 6c 20 72 | 65 74 75 72 6e 20 73 6f |) will r|eturn so| |00005880| 6d 65 20 76 61 6c 75 65 | 20 74 68 61 74 20 75 6c |me value| that ul| |00005890| 74 69 6d 61 74 65 6c 79 | 20 63 61 6e 20 62 65 20 |timately| can be | |000058a0| 63 6f 6e 76 65 72 74 65 | 64 20 69 6e 74 6f 20 61 |converte|d into a| |000058b0| 20 6c 75 6d 69 6e 61 6e | 63 65 20 74 68 72 65 73 | luminan|ce thres| |000058c0| 68 6f 6c 64 20 69 6e 20 | 74 68 65 20 6d 61 74 72 |hold in |the matr| |000058d0| 69 78 2e 20 49 66 20 74 | 68 65 20 64 65 73 69 72 |ix. If t|he desir| |000058e0| 65 64 20 70 61 74 74 65 | 72 6e 20 69 73 20 61 20 |ed patte|rn is a | |000058f0| 64 6f 74 20 74 68 61 74 | 20 67 72 6f 77 73 20 66 |dot that| grows f| |00005900| 72 6f 6d 20 74 68 65 20 | 63 65 6e 74 65 72 20 61 |rom the |center a| |00005910| 73 20 74 68 65 20 6c 75 | 6d 69 6e 61 6e 63 65 20 |s the lu|minance | |00005920| 64 65 63 72 65 61 73 65 | 73 20 28 6b 6e 6f 77 6e |decrease|s (known| |00005930| 20 61 73 20 61 20 63 6c | 75 73 74 65 72 65 64 2d | as a cl|ustered-| |00005940| 64 6f 74 20 68 61 6c 66 | 74 6f 6e 65 29 2c 20 73 |dot half|tone), s| |00005950| 70 6f 74 2d 66 75 6e 63 | 74 69 6f 6e 28 78 2c 20 |pot-func|tion(x, | |00005960| 79 29 20 69 73 20 73 69 | 6d 70 6c 79 20 74 68 65 |y) is si|mply the| |00005970| 20 64 69 73 74 61 6e 63 | 65 20 66 72 6f 6d 20 28 | distanc|e from (| |00005980| 78 2c 20 79 29 20 74 6f | 20 74 68 65 20 63 65 6e |x, y) to| the cen| |00005990| 74 65 72 20 6f 66 20 74 | 68 65 20 63 65 6c 6c 20 |ter of t|he cell | |000059a0| 28 30 2e 35 2c 20 30 2e | 35 29 2e 20 54 68 65 20 |(0.5, 0.|5). The | |000059b0| 64 69 74 68 65 72 20 6d | 61 74 72 69 78 20 77 6f |dither m|atrix wo| |000059c0| 75 6c 64 20 62 65 20 67 | 65 6e 65 72 61 74 65 64 |uld be g|enerated| |000059d0| 20 66 72 6f 6d 20 74 68 | 65 20 73 70 6f 74 20 66 | from th|e spot f| |000059e0| 75 6e 63 74 69 6f 6e 20 | 61 73 20 66 6f 6c 6c 6f |unction |as follo| |000059f0| 77 73 3a 0d 66 6f 72 20 | 69 20 3d 20 31 20 74 6f |ws:.for |i = 1 to| |00005a00| 20 6d 0d 09 78 20 3d 20 | 69 2f 6d 0d 09 66 6f 72 | m..x = |i/m..for| |00005a10| 20 6a 20 3d 20 31 20 74 | 6f 20 6e 0d 09 09 79 20 | j = 1 t|o n...y | |00005a20| 3d 20 6a 2f 6e 0d 09 09 | 6d 61 74 72 69 78 5b 69 |= j/n...|matrix[i| |00005a30| 2c 20 6a 5d 20 3d 20 73 | 70 6f 74 2d 66 75 6e 63 |, j] = s|pot-func| |00005a40| 74 69 6f 6e 28 78 2c 20 | 79 29 0d 54 68 65 20 72 |tion(x, |y).The r| |00005a50| 65 73 75 6c 74 20 6f 66 | 20 74 68 69 73 20 70 72 |esult of| this pr| |00005a60| 6f 63 65 73 73 20 69 73 | 20 74 68 61 74 20 74 68 |ocess is| that th| |00005a70| 65 20 6d 61 74 72 69 78 | 20 63 6f 6e 74 61 69 6e |e matrix| contain| |00005a80| 73 20 74 68 65 20 73 70 | 6f 74 20 66 75 6e 63 74 |s the sp|ot funct| |00005a90| 69 6f 6e d5 73 20 72 65 | 73 75 6c 74 73 2e 20 57 |ion.s re|sults. W| |00005aa0| 68 61 74 20 77 65 20 72 | 65 61 6c 6c 79 20 77 61 |hat we r|eally wa| |00005ab0| 6e 74 20 69 6e 20 74 68 | 65 20 6d 61 74 72 69 78 |nt in th|e matrix| |00005ac0| 20 61 72 65 20 74 68 72 | 65 73 68 6f 6c 64 20 76 | are thr|eshold v| |00005ad0| 61 6c 75 65 73 20 66 6f | 72 20 74 68 65 20 6c 75 |alues fo|r the lu| |00005ae0| 6d 69 6e 61 6e 63 65 2e | 20 54 68 65 20 73 70 6f |minance.| The spo| |00005af0| 74 20 0d 66 75 6e 63 74 | 69 6f 6e 20 72 65 73 75 |t .funct|ion resu| |00005b00| 6c 74 20 69 73 20 63 6f | 6e 76 65 72 74 65 64 20 |lt is co|nverted | |00005b10| 61 73 20 66 6f 6c 6c 6f | 77 73 3a 20 54 72 65 61 |as follo|ws: Trea| |00005b20| 74 69 6e 67 20 74 68 65 | 20 64 69 74 68 65 72 20 |ting the| dither | |00005b30| 6d 61 74 72 69 78 20 61 | 73 20 61 20 6f 6e 65 2d |matrix a|s a one-| |00005b40| 64 69 6d 65 6e 73 69 6f | 6e 61 6c 20 61 72 72 61 |dimensio|nal arra| |00005b50| 79 20 41 2c 20 67 65 6e | 65 72 61 74 65 20 61 20 |y A, gen|erate a | |00005b60| 73 6f 72 74 20 76 65 63 | 74 6f 72 20 56 20 73 75 |sort vec|tor V su| |00005b70| 63 68 20 74 68 61 74 20 | 41 5b 56 5b 69 5d 5d 20 |ch that |A[V[i]] | |00005b80| 69 73 20 73 6f 72 74 65 | 64 20 61 73 20 69 20 67 |is sorte|d as i g| |00005b90| 6f 65 73 20 66 72 6f 6d | 20 31 20 74 6f 20 6d 2a |oes from| 1 to m*| |00005ba0| 6e 2e 20 54 68 65 6e 2c | 20 72 65 70 6c 61 63 69 |n. Then,| replaci| |00005bb0| 6e 67 20 61 6c 6c 20 6f | 66 20 74 68 65 20 76 61 |ng all o|f the va| |00005bc0| 6c 75 65 73 20 69 6e 20 | 41 20 77 69 74 68 20 56 |lues in |A with V| |00005bd0| 5b 69 5d 20 2a 20 31 30 | 30 2f 28 6d 2a 6e 29 20 |[i] * 10|0/(m*n) | |00005be0| 77 69 6c 6c 20 79 69 65 | 6c 64 20 74 68 65 20 64 |will yie|ld the d| |00005bf0| 65 73 69 72 65 64 20 74 | 68 72 65 73 68 6f 6c 64 |esired t|hreshold| |00005c00| 20 6d 61 74 72 69 78 2c | 20 77 69 74 68 20 65 61 | matrix,| with ea| |00005c10| 63 68 20 76 61 6c 75 65 | 20 62 65 69 6e 67 20 61 |ch value| being a| |00005c20| 20 70 65 72 63 65 6e 74 | 61 67 65 20 6f 66 20 6c | percent|age of l| |00005c30| 75 6d 69 6e 61 6e 63 65 | 2e 20 28 54 68 65 20 63 |uminance|. (The c| |00005c40| 6f 64 65 20 75 73 65 73 | 20 6e 75 6d 62 65 72 73 |ode uses| numbers| |00005c50| 20 74 68 61 74 20 61 72 | 65 20 6d 6f 72 65 20 63 | that ar|e more c| |00005c60| 6f 6d 70 75 74 65 72 2d | 66 72 69 65 6e 64 6c 79 |omputer-|friendly| |00005c70| 20 74 68 61 6e 20 70 65 | 72 63 65 6e 74 61 67 65 | than pe|rcentage| |00005c80| 73 2e 29 20 54 68 65 73 | 65 20 70 65 72 63 65 6e |s.) Thes|e percen| |00005c90| 74 61 67 65 73 20 61 73 | 73 75 6d 65 20 74 68 61 |tages as|sume tha| |00005ca0| 74 20 74 68 65 20 64 65 | 76 69 63 65 20 69 73 20 |t the de|vice is | |00005cb0| 63 61 70 61 62 6c 65 20 | 6f 66 20 61 63 63 75 72 |capable |of accur| |00005cc0| 61 74 65 6c 79 20 72 65 | 6e 64 65 72 69 6e 67 20 |ately re|ndering | |00005cd0| 61 20 73 69 6e 67 6c 65 | 20 70 69 78 65 6c 2e 20 |a single| pixel. | |00005ce0| 54 68 65 20 76 61 6c 75 | 65 73 20 63 61 6e 20 62 |The valu|es can b| |00005cf0| 65 20 6d 6f 64 69 66 69 | 65 64 20 62 79 20 61 20 |e modifi|ed by a | |00005d00| 67 61 6d 6d 61 20 66 75 | 6e 63 74 69 6f 6e 20 74 |gamma fu|nction t| |00005d10| 6f 20 6d 6f 72 65 20 61 | 63 63 75 72 61 74 65 6c |o more a|ccuratel| |00005d20| 79 20 70 72 6f 64 75 63 | 65 20 61 20 6c 69 6e 65 |y produc|e a line| |00005d30| 61 72 20 72 65 6c 61 74 | 69 6f 6e 73 68 69 70 20 |ar relat|ionship | |00005d40| 62 65 74 77 65 65 6e 20 | 69 6d 61 67 65 20 6c 75 |between |image lu| |00005d50| 6d 69 6e 61 6e 63 65 20 | 61 6e 64 20 70 69 78 65 |minance |and pixe| |00005d60| 6c 20 64 65 6e 73 69 74 | 79 2e 0d 4f 72 64 65 72 |l densit|y..Order| |00005d70| 65 64 20 64 69 74 68 65 | 72 69 6e 67 20 69 73 20 |ed dithe|ring is | |00005d80| 67 65 6e 65 72 61 6c 6c | 79 20 64 6f 6e 65 20 61 |generall|y done a| |00005d90| 74 20 61 20 73 70 65 63 | 69 66 69 63 20 61 6e 67 |t a spec|ific ang| |00005da0| 6c 65 20 61 6e 64 20 66 | 72 65 71 75 65 6e 63 79 |le and f|requency| |00005db0| 2e 20 54 68 65 20 66 72 | 65 71 75 65 6e 63 79 20 |. The fr|equency | |00005dc0| 69 73 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |is the n|umber of| |00005dd0| 20 63 65 6c 6c 73 20 28 | 6f 72 20 64 69 74 68 65 | cells (|or dithe| |00005de0| 72 20 6d 61 74 72 69 78 | 65 73 29 20 70 65 72 20 |r matrix|es) per | |00005df0| 69 6e 63 68 20 61 6e 64 | 20 74 68 65 20 61 6e 67 |inch and| the ang| |00005e00| 6c 65 20 72 65 66 65 72 | 73 20 74 6f 20 68 6f 77 |le refer|s to how| |00005e10| 20 74 68 65 20 70 72 6f | 64 75 63 65 64 20 70 61 | the pro|duced pa| |00005e20| 74 74 65 72 6e 73 20 61 | 72 65 20 6f 72 69 65 6e |tterns a|re orien| |00005e30| 74 65 64 20 77 69 74 68 | 20 72 65 73 70 65 63 74 |ted with| respect| |00005e40| 20 74 6f 20 74 68 65 20 | 64 65 76 69 63 65 20 67 | to the |device g| |00005e50| 72 69 64 2e 20 49 6e 20 | 74 68 65 20 70 72 65 63 |rid. In |the prec| |00005e60| 65 64 69 6e 67 20 65 78 | 61 6d 70 6c 65 2c 20 74 |eding ex|ample, t| |00005e70| 68 65 20 66 72 65 71 75 | 65 6e 63 79 20 28 69 66 |he frequ|ency (if| |00005e80| 20 70 72 69 6e 74 69 6e | 67 20 6f 6e 20 61 20 33 | printin|g on a 3| |00005e90| 30 30 2d 64 70 69 20 64 | 65 76 69 63 65 29 20 69 |00-dpi d|evice) i| |00005ea0| 73 20 31 35 30 20 63 65 | 6c 6c 73 20 70 65 72 20 |s 150 ce|lls per | |00005eb0| 69 6e 63 68 20 61 6e 64 | 20 74 68 65 20 61 6e 67 |inch and| the ang| |00005ec0| 6c 65 20 69 73 20 30 fb | 2e 20 0d 42 65 63 61 75 |le is 0.|. .Becau| |00005ed0| 73 65 20 6f 66 20 74 68 | 65 20 77 61 79 20 6f 75 |se of th|e way ou| |00005ee0| 72 20 62 72 61 69 6e 73 | 20 77 6f 72 6b 20 28 6f |r brains| work (o| |00005ef0| 75 72 20 65 79 65 73 20 | 74 65 6e 64 20 74 6f 20 |ur eyes |tend to | |00005f00| 70 69 63 6b 20 75 70 20 | 70 61 74 74 65 72 6e 73 |pick up |patterns| |00005f10| 20 61 74 20 39 30 fb 20 | 61 6e 67 6c 65 73 20 62 | at 90. |angles b| |00005f20| 75 74 20 6e 6f 74 20 61 | 74 20 34 35 fb 20 61 6e |ut not a|t 45. an| |00005f30| 67 6c 65 73 29 2c 20 69 | 74 d5 73 20 64 65 73 69 |gles), i|t.s desi| |00005f40| 72 61 62 6c 65 20 74 6f | 20 6f 72 69 65 6e 74 20 |rable to| orient | |00005f50| 74 68 65 73 65 20 70 61 | 74 74 65 72 6e 73 20 61 |these pa|tterns a| |00005f60| 74 20 61 72 62 69 74 72 | 61 72 79 20 61 6e 67 6c |t arbitr|ary angl| |00005f70| 65 73 2e 20 53 69 6e 63 | 65 20 74 68 65 20 64 69 |es. Sinc|e the di| |00005f80| 74 68 65 72 20 6d 61 74 | 72 69 78 20 69 74 73 65 |ther mat|rix itse| |00005f90| 6c 66 20 69 73 20 6e 65 | 76 65 72 20 72 6f 74 61 |lf is ne|ver rota| |00005fa0| 74 65 64 20 77 69 74 68 | 20 72 65 73 70 65 63 74 |ted with| respect| |00005fb0| 20 74 6f 20 74 68 65 20 | 64 65 76 69 63 65 2c 20 | to the |device, | |00005fc0| 77 65 20 6d 75 73 74 20 | 67 65 6e 65 72 61 74 65 |we must |generate| |00005fd0| 20 74 68 65 20 64 69 74 | 68 65 72 20 6d 61 74 72 | the dit|her matr| |00005fe0| 69 78 20 69 6e 20 73 75 | 63 68 20 61 20 77 61 79 |ix in su|ch a way| |00005ff0| 20 74 68 61 74 20 69 74 | 20 63 6f 6e 74 61 69 6e | that it| contain| |00006000| 73 20 65 6e 6f 75 67 68 | 20 72 65 70 65 74 69 74 |s enough| repetit| |00006010| 69 6f 6e 73 20 6f 66 20 | 74 68 65 20 72 6f 74 61 |ions of |the rota| |00006020| 74 65 64 20 63 65 6c 6c | 20 74 6f 20 61 63 68 69 |ted cell| to achi| |00006030| 65 76 65 20 74 68 65 20 | 65 66 66 65 63 74 20 6f |eve the |effect o| |00006040| 66 20 62 65 69 6e 67 20 | 72 6f 74 61 74 65 64 20 |f being |rotated | |00006050| 69 74 73 65 6c 66 2e 20 | 49 6e 20 6f 74 68 65 72 |itself. |In other| |00006060| 20 77 6f 72 64 73 2c 20 | 62 65 63 61 75 73 65 20 | words, |because | |00006070| 61 20 73 71 75 61 72 65 | 20 64 65 76 69 63 65 20 |a square| device | |00006080| 72 65 71 75 69 72 65 73 | 20 75 73 20 74 6f 20 d2 |requires| us to .| |00006090| 74 69 6c 65 d3 20 61 6e | 20 61 72 65 61 20 77 69 |tile. an| area wi| |000060a0| 74 68 20 30 fb 20 72 65 | 63 74 61 6e 67 6c 65 73 |th 0. re|ctangles| |000060b0| 2c 20 77 65 20 6e 65 65 | 64 20 74 6f 20 66 69 6e |, we nee|d to fin| |000060c0| 64 20 61 20 30 fb 20 72 | 65 63 74 61 6e 67 6c 65 |d a 0. r|ectangle| |000060d0| 20 65 6e 63 6c 6f 73 69 | 6e 67 20 61 20 70 61 72 | enclosi|ng a par| |000060e0| 74 20 6f 66 20 74 68 65 | 20 72 6f 74 61 74 65 64 |t of the| rotated| |000060f0| 20 70 61 74 74 65 72 6e | 20 74 68 61 74 20 66 6f | pattern| that fo| |00006100| 72 6d 73 20 61 20 72 65 | 70 65 61 74 61 62 6c 65 |rms a re|peatable| |00006110| 20 74 69 6c 65 2e 20 46 | 6f 72 20 73 6f 6d 65 20 | tile. F|or some | |00006120| 61 6e 67 6c 65 73 20 6f | 66 20 72 6f 74 61 74 69 |angles o|f rotati| |00006130| 6f 6e 2c 20 74 68 69 73 | 20 72 65 63 74 61 6e 67 |on, this| rectang| |00006140| 6c 65 20 6d 61 79 20 62 | 65 20 6d 75 63 68 20 6c |le may b|e much l| |00006150| 61 72 67 65 72 20 74 68 | 61 6e 20 74 68 65 20 70 |arger th|an the p| |00006160| 61 74 74 65 72 6e 20 69 | 74 73 65 6c 66 2e 0d 53 |attern i|tself..S| |00006170| 75 70 70 6f 73 65 20 77 | 65 20 77 61 6e 74 20 74 |uppose w|e want t| |00006180| 6f 20 68 61 6c 66 74 6f | 6e 65 20 74 6f 20 61 20 |o halfto|ne to a | |00006190| 33 30 30 2d 64 70 69 20 | 64 65 76 69 63 65 20 61 |300-dpi |device a| |000061a0| 74 20 61 20 66 72 65 71 | 75 65 6e 63 79 20 6f 66 |t a freq|uency of| |000061b0| 20 36 30 20 63 65 6c 6c | 73 20 70 65 72 20 69 6e | 60 cell|s per in| |000061c0| 63 68 20 61 6e 64 20 61 | 6e 20 61 6e 67 6c 65 20 |ch and a|n angle | |000061d0| 6f 66 20 34 35 fb 2e 20 | 41 74 20 30 fb 2c 20 74 |of 45.. |At 0., t| |000061e0| 68 65 20 64 69 74 68 65 | 72 20 6d 61 74 72 69 78 |he dithe|r matrix| |000061f0| 20 77 6f 75 6c 64 20 62 | 65 20 35 78 35 20 28 33 | would b|e 5x5 (3| |00006200| 30 30 2f 36 30 29 2c 20 | 79 69 65 6c 64 69 6e 67 |00/60), |yielding| |00006210| 20 32 36 20 70 6f 73 73 | 69 62 6c 65 20 73 68 61 | 26 poss|ible sha| |00006220| 64 65 73 20 6f 66 20 67 | 72 61 79 2e 20 48 6f 77 |des of g|ray. How| |00006230| 65 76 65 72 2c 20 61 73 | 20 46 69 67 75 72 65 20 |ever, as| Figure | |00006240| 35 20 69 6c 6c 75 73 74 | 72 61 74 65 73 2c 20 77 |5 illust|rates, w| |00006250| 65 20 6e 65 65 64 20 61 | 6e 20 38 78 38 20 6d 61 |e need a|n 8x8 ma| |00006260| 74 72 69 78 20 74 6f 20 | 61 70 70 72 6f 78 69 6d |trix to |approxim| |00006270| 61 74 65 20 74 68 65 20 | 64 65 73 69 72 65 64 20 |ate the |desired | |00006280| 61 6e 67 6c 65 2e 20 54 | 68 65 73 65 20 64 69 6d |angle. T|hese dim| |00006290| 65 6e 73 69 6f 6e 73 20 | 61 72 65 20 66 6f 75 6e |ensions |are foun| |000062a0| 64 20 62 79 20 72 6f 74 | 61 74 69 6e 67 20 74 68 |d by rot|ating th| |000062b0| 65 20 76 65 63 74 6f 72 | 73 20 28 30 2c 20 35 29 |e vector|s (0, 5)| |000062c0| 20 61 6e 64 20 28 35 2c | 20 30 29 20 62 79 20 34 | and (5,| 0) by 4| |000062d0| 35 fb 20 61 6e 64 20 70 | 69 6e 6e 69 6e 67 20 74 |5. and p|inning t| |000062e0| 68 65 6d 20 74 6f 20 69 | 6e 74 65 67 65 72 73 2c |hem to i|ntegers,| |000062f0| 20 79 69 65 6c 64 69 6e | 67 20 74 68 65 20 76 65 | yieldin|g the ve| |00006300| 63 74 6f 72 73 20 28 34 | 2c 20 34 29 20 61 6e 64 |ctors (4|, 4) and| |00006310| 20 0d 28 2d 34 2c 20 34 | 29 2e 20 53 69 6e 63 65 | .(-4, 4|). Since| |00006320| 20 74 68 65 20 6d 61 67 | 6e 69 74 75 64 65 20 6f | the mag|nitude o| |00006330| 66 20 74 68 65 20 76 65 | 63 74 6f 72 20 28 34 2c |f the ve|ctor (4,| |00006340| 20 34 29 20 69 73 20 34 | 2a 73 71 72 74 28 32 29 | 4) is 4|*sqrt(2)| |00006350| 2c 20 74 68 65 20 61 63 | 74 75 61 6c 20 68 61 6c |, the ac|tual hal| |00006360| 66 74 6f 6e 65 20 66 72 | 65 71 75 65 6e 63 79 20 |ftone fr|equency | |00006370| 61 63 68 69 65 76 65 64 | 20 77 69 6c 6c 20 62 65 |achieved| will be| |00006380| 20 33 30 30 2f 28 34 2a | 73 71 72 74 28 32 29 29 | 300/(4*|sqrt(2))| |00006390| 2c 20 61 72 6f 75 6e 64 | 20 35 33 2e 20 54 68 65 |, around| 53. The| |000063a0| 20 65 72 72 6f 72 20 69 | 6e 20 66 72 65 71 75 65 | error i|n freque| |000063b0| 6e 63 79 20 61 6e 64 20 | 61 6e 67 6c 65 20 69 73 |ncy and |angle is| |000063c0| 20 64 75 65 20 74 6f 20 | 74 68 65 20 6e 65 65 64 | due to |the need| |000063d0| 20 74 6f 20 70 69 6e 20 | 74 68 65 20 76 65 63 74 | to pin |the vect| |000063e0| 6f 72 73 20 74 6f 20 69 | 6e 74 65 67 65 72 20 73 |ors to i|nteger s| |000063f0| 70 61 63 65 2e 0d 48 65 | 72 65 d5 73 20 74 68 65 |pace..He|re.s the| +--------+-------------------------+-------------------------+--------+--------+ Only 25.0 KB of data is shown above.